2023-02-20 10:35:04 -05:00
|
|
|
// deno-fmt-ignore-file
|
|
|
|
// deno-lint-ignore-file
|
|
|
|
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
|
|
// Taken from Node 18.12.1
|
2023-06-02 02:05:32 -04:00
|
|
|
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
|
2023-02-20 10:35:04 -05:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
require('../common');
|
|
|
|
const common = require('../common');
|
|
|
|
const dns = require('dns');
|
|
|
|
const dnsPromises = dns.promises;
|
|
|
|
const { addresses } = require('../common/internet');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
assert.rejects(
|
|
|
|
dnsPromises.lookup(addresses.NOT_FOUND, {
|
|
|
|
hints: 0,
|
|
|
|
family: 0,
|
2023-11-24 21:35:36 -05:00
|
|
|
all: false,
|
2023-02-20 10:35:04 -05:00
|
|
|
}),
|
|
|
|
{
|
|
|
|
code: 'ENOTFOUND',
|
2023-11-24 21:35:36 -05:00
|
|
|
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
|
|
|
|
},
|
2023-02-20 10:35:04 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
assert.rejects(
|
|
|
|
dnsPromises.lookup(addresses.NOT_FOUND, {
|
|
|
|
hints: 0,
|
|
|
|
family: 0,
|
2023-11-24 21:35:36 -05:00
|
|
|
all: true,
|
2023-02-20 10:35:04 -05:00
|
|
|
}),
|
|
|
|
{
|
|
|
|
code: 'ENOTFOUND',
|
2023-11-24 21:35:36 -05:00
|
|
|
message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
|
|
|
|
},
|
2023-02-20 10:35:04 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
dns.lookup(addresses.NOT_FOUND, {
|
|
|
|
hints: 0,
|
|
|
|
family: 0,
|
2023-11-24 21:35:36 -05:00
|
|
|
all: true,
|
2023-02-20 10:35:04 -05:00
|
|
|
}, common.mustCall((error) => {
|
|
|
|
assert.strictEqual(error.code, 'ENOTFOUND');
|
|
|
|
assert.strictEqual(
|
|
|
|
error.message,
|
2023-11-24 21:35:36 -05:00
|
|
|
`getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`,
|
2023-02-20 10:35:04 -05:00
|
|
|
);
|
|
|
|
assert.strictEqual(error.syscall, 'getaddrinfo');
|
|
|
|
assert.strictEqual(error.hostname, addresses.NOT_FOUND);
|
|
|
|
}));
|
|
|
|
|
|
|
|
assert.throws(
|
|
|
|
() => dnsPromises.lookup(addresses.NOT_FOUND, {
|
|
|
|
family: 'ipv4',
|
2023-11-24 21:35:36 -05:00
|
|
|
all: 'all',
|
2023-02-20 10:35:04 -05:00
|
|
|
}),
|
2023-11-24 21:35:36 -05:00
|
|
|
{ code: 'ERR_INVALID_ARG_VALUE' },
|
2023-02-20 10:35:04 -05:00
|
|
|
);
|