Skip to content

Commit 3ec420c

Browse files
JoshMockgithub-actions[bot]
authored andcommitted
1 parent 074b335 commit 3ec420c

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

test/unit/helpers/bulk.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,37 @@ test('bulk update', t => {
914914
})
915915
})
916916

917+
t.test('Should not allow asStream request option', async t => {
918+
t.plan(2)
919+
920+
const client = new Client({
921+
node: 'http://localhost:9200',
922+
})
923+
924+
try {
925+
await client.helpers.bulk({
926+
datasource: dataset.slice(),
927+
flushBytes: 1,
928+
concurrency: 1,
929+
onDocument (doc) {
930+
return { index: { _index: 'test' } }
931+
},
932+
onDrop (doc) {
933+
t.fail('This should never be called')
934+
},
935+
refreshOnCompletion: true
936+
}, {
937+
headers: {
938+
foo: 'bar'
939+
},
940+
asStream: true,
941+
})
942+
} catch (err: any) {
943+
t.ok(err instanceof AssertionError)
944+
t.equal(err.message, 'bulk helper: the asStream request option is not supported')
945+
}
946+
})
947+
917948
t.end()
918949
})
919950

test/unit/helpers/bulk.test.ts.rej

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff a/test/unit/helpers/bulk.test.ts b/test/unit/helpers/bulk.test.ts (rejected hunks)
2+
@@ -18,6 +18,7 @@
3+
*/
4+
5+
import FakeTimers from '@sinonjs/fake-timers'
6+
+import { AssertionError } from 'assert'
7+
import { createReadStream } from 'fs'
8+
import * as http from 'http'
9+
import { join } from 'path'

0 commit comments

Comments
 (0)