Skip to content

Commit

Permalink
fixup: keep promise chain
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Mar 30, 2021
1 parent 7a2eed1 commit 05c7664
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions test/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ test('agent should close internal pools', t => {
})

dispatcher.once('connect', () => {
dispatcher.close().then(() => {
request(origin, { dispatcher })
.then(() => {
t.fail('second request should not resolve')
})
.catch(err => {
t.ok(err instanceof errors.ClientClosedError)
})
})
dispatcher.close()
.then(() => request(origin, { dispatcher }))
.then(() => {
t.fail('second request should not resolve')
})
.catch(err => {
t.ok(err instanceof errors.ClientClosedError)
})
})
})
})
Expand Down Expand Up @@ -98,15 +97,14 @@ test('agent should destroy internal pools', t => {
})

dispatcher.once('connect', () => {
dispatcher.destroy().then(() => {
request(origin, { dispatcher })
.then(() => {
t.fail()
})
.catch(err => {
t.ok(err instanceof errors.ClientDestroyedError)
})
})
dispatcher.destroy()
.then(() => request(origin, { dispatcher }))
.then(() => {
t.fail()
})
.catch(err => {
t.ok(err instanceof errors.ClientDestroyedError)
})
})
})
})
Expand Down

0 comments on commit 05c7664

Please sign in to comment.