mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 13:09:42 +00:00

Use const over var. Assert error message with regex. PR-URL: https://github.com/nodejs/node/pull/9891 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
23 lines
499 B
JavaScript
23 lines
499 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
connect({
|
|
host: 'localhost',
|
|
port: common.PORT,
|
|
localPort: 'foobar',
|
|
}, /^TypeError: "localPort" option should be a number: foobar$/);
|
|
|
|
connect({
|
|
host: 'localhost',
|
|
port: common.PORT,
|
|
localAddress: 'foobar',
|
|
}, /^TypeError: "localAddress" option must be a valid IP: foobar$/);
|
|
|
|
function connect(opts, msg) {
|
|
assert.throws(function() {
|
|
net.connect(opts);
|
|
}, msg);
|
|
}
|