Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshMock authored and github-actions[bot] committed Mar 27, 2024
1 parent 074b335 commit 3ec420c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/unit/helpers/bulk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,37 @@ test('bulk update', t => {
})
})

t.test('Should not allow asStream request option', async t => {
t.plan(2)

const client = new Client({
node: 'http://localhost:9200',
})

try {
await client.helpers.bulk({
datasource: dataset.slice(),
flushBytes: 1,
concurrency: 1,
onDocument (doc) {
return { index: { _index: 'test' } }
},
onDrop (doc) {
t.fail('This should never be called')
},
refreshOnCompletion: true

Check failure on line 935 in test/unit/helpers/bulk.test.ts

View workflow job for this annotation

GitHub Actions / Test (18.x, ubuntu-latest)

Object literal may only specify known properties, and 'refreshOnCompletion' does not exist in type 'BulkHelperOptions<{ user: string; age: number; }>'.

Check failure on line 935 in test/unit/helpers/bulk.test.ts

View workflow job for this annotation

GitHub Actions / Test (20.x, ubuntu-latest)

Object literal may only specify known properties, and 'refreshOnCompletion' does not exist in type 'BulkHelperOptions<{ user: string; age: number; }>'.

Check failure on line 935 in test/unit/helpers/bulk.test.ts

View workflow job for this annotation

GitHub Actions / Test (20.x, macOS-latest)

Object literal may only specify known properties, and 'refreshOnCompletion' does not exist in type 'BulkHelperOptions<{ user: string; age: number; }>'.
}, {
headers: {
foo: 'bar'
},
asStream: true,
})
} catch (err: any) {
t.ok(err instanceof AssertionError)
t.equal(err.message, 'bulk helper: the asStream request option is not supported')
}
})

t.end()
})

Expand Down
9 changes: 9 additions & 0 deletions test/unit/helpers/bulk.test.ts.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff a/test/unit/helpers/bulk.test.ts b/test/unit/helpers/bulk.test.ts (rejected hunks)
@@ -18,6 +18,7 @@
*/

import FakeTimers from '@sinonjs/fake-timers'
+import { AssertionError } from 'assert'
import { createReadStream } from 'fs'
import * as http from 'http'
import { join } from 'path'

0 comments on commit 3ec420c

Please sign in to comment.