Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
Fix the connection error test to work with NodeJS 12.x
Browse files Browse the repository at this point in the history
NodeJS 12.x removed the (useless) 'host:port' part of the connection errors with
nodejs/node#26751, adapt the code here to check with a pattern
that handles both NodeJS 12.x and earlier versions.
  • Loading branch information
ankon committed Nov 5, 2019
1 parent 34824cb commit 5c9bcc5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/network/connection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ describe('Network > Connection', () => {

test('rejects the Promise in case of errors', async () => {
connection.host = invalidHost
await expect(connection.connect()).rejects.toHaveProperty(
'message',
'Connection error: getaddrinfo ENOTFOUND kafkajs.test kafkajs.test:9092'
)
const messagePattern = /Connection error: getaddrinfo ENOTFOUND kafkajs.test/
await expect(connection.connect()).rejects.toThrow(messagePattern)
expect(connection.connected).toEqual(false)
})
})
Expand Down

0 comments on commit 5c9bcc5

Please sign in to comment.