Skip to content

Commit

Permalink
test: make existing test more resilient without changing its logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Dec 12, 2021
1 parent 7873556 commit ec8fb81
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test_client_request.js
Expand Up @@ -108,11 +108,13 @@ describe('Direct use of `ClientRequest`', () => {

it('should emit an expected error when no interceptors and net connect is disallowed', done => {
nock.disableNetConnect()
new http.ClientRequest({ port: 12345, path: '/' }).on('error', err => {
expect(err.message).to.equal(
'Nock: Disallowed net connect for "localhost:12345/"'
)
done()
})
new http.ClientRequest({ port: 12345, path: '/' })
.on('error', err => {
expect(err.message).to.equal(
'Nock: Disallowed net connect for "localhost:12345/"'
)
done()
})
.on('close', done(new Error('Should not permit to connect')))
})
})

0 comments on commit ec8fb81

Please sign in to comment.