node/test/parallel/test-net-dns-error.js
Rich Trott 082cc8d6d8 test: remove unnecessary assignments
common.js needs to be loaded in all tests so that there is checking
for variable leaks and possibly other things. However, it does not
need to be assigned to a variable if nothing in common.js is referred
to elsewhere in the test.

PR-URL: https://github.com/nodejs/node/pull/4408
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-26 18:00:02 -08:00

36 lines
793 B
JavaScript

'use strict';
require('../common');
var assert = require('assert');
var net = require('net');
var expected_bad_connections = 1;
var actual_bad_connections = 0;
var host = '********';
host += host;
host += host;
host += host;
host += host;
host += host;
function do_not_call() {
throw new Error('This function should not have been called.');
}
var socket = net.connect(42, host, do_not_call);
socket.on('error', function(err) {
assert.equal(err.code, 'ENOTFOUND');
actual_bad_connections++;
});
socket.on('lookup', function(err, ip, type) {
assert(err instanceof Error);
assert.equal(err.code, 'ENOTFOUND');
assert.equal(ip, undefined);
assert.equal(type, undefined);
});
process.on('exit', function() {
assert.equal(actual_bad_connections, expected_bad_connections);
});