Skip to content

Commit

Permalink
chore: fix flaky test (#3680)
Browse files Browse the repository at this point in the history
Because the requests are initiated with `Promise.all`, there's no
guarantee which order they arrive at the server in so when we check
the responses, just make sure the length and contents are correct
instead of the order.
  • Loading branch information
achingbrain committed May 10, 2021
1 parent d85613e commit 4ea0aa9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/node/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,16 @@ describe('agent', function () {
}

const results = await requests

expect(results).to.deep.equal([{
expect(results).to.have.lengthOf(3)
expect(results).to.deep.include({
res: 0
}, {
})
expect(results).to.deep.include({
res: 1
}, {
})
expect(results).to.deep.include({
res: 2
}])
})

server.close()
})
Expand Down

0 comments on commit 4ea0aa9

Please sign in to comment.