mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

* Favor strictEqual * Use const where appropriate * Modernize where possible PR-URL: https://github.com/nodejs/node/pull/8468 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
608 B
JavaScript
26 lines
608 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cares = process.binding('cares_wrap');
|
|
|
|
const dns = require('dns');
|
|
|
|
// Stub `getaddrinfo` to *always* error.
|
|
cares.getaddrinfo = function() {
|
|
return process.binding('uv').UV_ENOENT;
|
|
};
|
|
|
|
assert.doesNotThrow(() => {
|
|
var tickValue = 0;
|
|
|
|
dns.lookup('example.com', common.mustCall((error, result, addressType) => {
|
|
assert(error);
|
|
assert.strictEqual(tickValue, 1);
|
|
assert.strictEqual(error.code, 'ENOENT');
|
|
}));
|
|
|
|
// Make sure that the error callback is called
|
|
// on next tick.
|
|
tickValue = 1;
|
|
});
|