File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -914,6 +914,37 @@ test('bulk update', t => {
914
914
} )
915
915
} )
916
916
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
+
917
948
t . end ( )
918
949
} )
919
950
Original file line number Diff line number Diff line change
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'
You can’t perform that action at this time.
0 commit comments