Skip to content

Commit

Permalink
fix(test): times out requests in node & browser
Browse files Browse the repository at this point in the history
  • Loading branch information
bencevans committed May 22, 2019
1 parent dc5a44c commit cd6acfb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions test/fixture/pool-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ module.exports = function () {
res.end(JSON.stringify({ ok: true }))
break

case 'wait-json':
setTimeout(() => {
res.end(JSON.stringify({ ok: true }))
}, 1500)
break

case 'badjson':
res.end('{')
break
Expand Down
2 changes: 1 addition & 1 deletion test/unit/pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('pool', () => {
it('times out requests', () => {
(pool as any)._timeout = 1;
return pool
.text({method: 'GET', path: '/pool/json'})
.text({method: 'GET', path: '/pool/wait-json'})
.then(() => {
throw new Error('Expected to have thrown');
})
Expand Down

0 comments on commit cd6acfb

Please sign in to comment.