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
|
2024-04-02 18:24:55 -04:00
|
|
|
// This file is automatically generated by `tests/node_compat/runner/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}`,
|
|
|
|
},
|
2024-06-11 07:41:44 -04:00
|
|
|
).then(common.mustCall());
|
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}`,
|
|
|
|
},
|
2024-06-11 07:41:44 -04:00
|
|
|
).then(common.mustCall());
|
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
|
|
|
);
|