node/test/parallel/test-regress-GH-5727.js
Gibson Fahnestock 3d2aef3979 test: s/assert.equal/assert.strictEqual/
Use assert.strictEqual instead of assert.equal in tests, manually
convert types where necessary.

PR-URL: https://github.com/nodejs/node/pull/10698
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2017-01-11 14:19:26 +00:00

31 lines
878 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const net = require('net');
const invalidPort = -1 >>> 0;
const errorMessage = /"port" argument must be >= 0 and < 65536/;
net.Server().listen(common.PORT, function() {
const address = this.address();
const key = `${address.family.slice(-1)}:${address.address}:${common.PORT}`;
assert.strictEqual(this._connectionKey, key);
this.close();
});
// The first argument is a configuration object
assert.throws(() => {
net.Server().listen({ port: invalidPort }, common.fail);
}, errorMessage);
// The first argument is the port, no IP given.
assert.throws(() => {
net.Server().listen(invalidPort, common.fail);
}, errorMessage);
// The first argument is the port, the second an IP.
assert.throws(() => {
net.Server().listen(invalidPort, '0.0.0.0', common.fail);
}, errorMessage);