Reorganized test and force 100% code coverage (#1226)

This commit is contained in:
Tomas Della Vedova
2020-06-15 08:37:04 +02:00
committed by delvedor
parent c08a0fa6ce
commit 08898ac4d5
16 changed files with 183 additions and 30 deletions

View File

@ -275,7 +275,7 @@ test('Stop a msearch processor (callbacks)', t => {
})
test('Bad header', t => {
t.plan(1)
t.plan(2)
const MockConnection = connection.buildMockConnection({
onRequest (params) {
@ -294,11 +294,16 @@ test('Bad header', t => {
t.strictEqual(err.message, 'The header should be an object')
})
m.search(null, { query: { match: { foo: 'bar' } } })
.catch(err => {
t.strictEqual(err.message, 'The header should be an object')
})
t.teardown(() => m.stop())
})
test('Bad body', t => {
t.plan(1)
t.plan(2)
const MockConnection = connection.buildMockConnection({
onRequest (params) {
@ -317,6 +322,11 @@ test('Bad body', t => {
t.strictEqual(err.message, 'The body should be an object')
})
m.search({ index: 'test' }, null)
.catch(err => {
t.strictEqual(err.message, 'The body should be an object')
})
t.teardown(() => m.stop())
})