Browse Source

test: Update to const and use regex for assertions

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>
v4.x
Daniel Flores 8 years ago
committed by Myles Borins
parent
commit
5cd7e7aaf1
  1. 10
      test/parallel/test-net-localerror.js

10
test/parallel/test-net-localerror.js

@ -1,19 +1,19 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
var assert = require('assert'); const assert = require('assert');
var net = require('net'); const net = require('net');
connect({ connect({
host: 'localhost', host: 'localhost',
port: common.PORT, port: common.PORT,
localPort: 'foobar', localPort: 'foobar',
}, 'localPort should be a number: foobar'); }, /^TypeError: localPort should be a number: foobar$/);
connect({ connect({
host: 'localhost', host: 'localhost',
port: common.PORT, port: common.PORT,
localAddress: 'foobar', localAddress: 'foobar',
}, 'localAddress should be a valid IP: foobar'); }, /^TypeError: localAddress must be a valid IP: foobar$/);
function connect(opts, msg) { function connect(opts, msg) {
assert.throws(function() { assert.throws(function() {

Loading…
Cancel
Save