Skip to content

Commit

Permalink
test: add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
metcoder95 committed Dec 18, 2024
1 parent f2b64e4 commit 656c9da
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/interceptors/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1814,3 +1814,28 @@ test('#3937 - Handle host correctly', async t => {
t.equal(response2.statusCode, 200)
t.equal(await response2.body.text(), 'hello world!')
})

test('#3951 - Should handle lookup errors correctly', async t => {
const suite = tspl(t, { plan: 1 })

const requestOptions = {
method: 'GET',
path: '/',
headers: {
'content-type': 'application/json'
}
}

const client = new Agent().compose([
dns({
lookup: (_origin, _opts, cb) => {
cb(new Error('lookup error'))
}
})
])

suite.rejects(client.request({
...requestOptions,
origin: 'http://localhost'
}), new Error('lookup error'))
})

0 comments on commit 656c9da

Please sign in to comment.