Skip to content

Commit

Permalink
[test] Fix error validation on node 9
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Oct 31, 2017
1 parent 31c81a9 commit d6934af
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/WebSocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ describe('WebSocket', function () {
});

it('accepts the localAddress option whether it was wrong interface', function () {
assert.throws(
() => new WebSocket(`ws://localhost:${port}`, { localAddress: '123.456.789.428' }),
/must be a valid IP: 123.456.789.428/
);
const localAddress = '123.456.789.428';

assert.throws(() => {
const ws = new WebSocket(`ws://localhost:${port}`, { localAddress });
}, (err) => {
return err instanceof TypeError && (err.code === 'ERR_INVALID_IP_ADDRESS' ||
err.message.includes(`must be a valid IP: ${localAddress}`));
});
});

it('accepts the family option', function (done) {
Expand Down

0 comments on commit d6934af

Please sign in to comment.