summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-dns-error.js
blob: aa288c5fde1ffaac61e6e911a7ef7d6438a77604 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
const common = require('../common');
const assert = require('assert');

const net = require('net');

const host = '*'.repeat(256);

function do_not_call() {
  throw new Error('This function should not have been called.');
}

const socket = net.connect(42, host, do_not_call);
socket.on('error', common.mustCall(function(err) {
  assert.equal(err.code, 'ENOTFOUND');
}));
socket.on('lookup', function(err, ip, type) {
  assert(err instanceof Error);
  assert.equal(err.code, 'ENOTFOUND');
  assert.equal(ip, undefined);
  assert.equal(type, undefined);
});