Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply patch from elastic/elasticsearch-js#2078 #48

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions test/unit/helpers/bulk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,36 @@ 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')
},
}, {
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 Expand Up @@ -1162,36 +1192,6 @@ test('transport options', 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')
},
}, {
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
Loading