Skip to content

Commit

Permalink
more test cases on server errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerhut committed May 28, 2024
1 parent de20de8 commit 511eef4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ test('should not keep error listeners (client error)', async t => {
})

test('should fail with server error', async t => {
const server = createServer()
server.on('request', (req, res) => {
server.emit('error', new Error('foo'))
res.end()
})
await t.throwsAsync(axiosist(server).get('/'), { message: 'foo' })
})

test('should fail with handled server error', async t => {
const server = createServer()
server.on('request', (req, res) => {
server.emit('error', new Error('foo'))
Expand Down

0 comments on commit 511eef4

Please sign in to comment.