fix(TransportRequestPromise): add finally method to TransportRequestP… (#1415)
* fix(TransportRequestPromise): add finally method to TransportRequestPromise interface * fix(TransportRequestPromise): add finally method to transportReturn object * fix(TransportRequestPromise): add finally method tests
This commit is contained in:
@ -124,6 +124,33 @@ test('Error (promises)', t => {
|
||||
})
|
||||
})
|
||||
|
||||
test('Finally method (promises)', t => {
|
||||
t.plan(1)
|
||||
|
||||
function handler (req, res) {
|
||||
res.setHeader('Content-Type', 'application/json;utf=8')
|
||||
res.end(JSON.stringify({ hello: 'world' }))
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
const client = new Client({
|
||||
node: `http://localhost:${port}`
|
||||
})
|
||||
|
||||
const request = client.search({
|
||||
index: 'test',
|
||||
q: 'foo:bar'
|
||||
})
|
||||
|
||||
t.type(request.finally, 'function')
|
||||
|
||||
request
|
||||
.finally(() => {
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Abort method (callback)', t => {
|
||||
t.plan(3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user