mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: remove duplicate tests
`test/parallel/test-dns-default-verbatim-false.js` is a duplicate of `test/parallel/test-dns-default-order-ipv4.js` and `test/parallel/test-dns-default-verbatim-true.js` is a duplicate of `test/parallel/test-dns-default-order-verbatim.js`. PR-URL: https://github.com/nodejs/node/pull/55393 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
1 parent
ef6707eb9b
commit
832300533b
2 files changed
-102
No files matched your search
@@ -1,51 +0,0 @@
|
||||
// Flags: --expose-internals --dns-result-order=ipv4first
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const cares = internalBinding('cares_wrap');
|
||||
const { promisify } = require('util');
|
||||
|
||||
// Test that --dns-result-order=ipv4first works as expected.
|
||||
|
||||
const originalGetaddrinfo = cares.getaddrinfo;
|
||||
const calls = [];
|
||||
cares.getaddrinfo = common.mustCallAtLeast((...args) => {
|
||||
calls.push(args);
|
||||
originalGetaddrinfo(...args);
|
||||
}, 1);
|
||||
|
||||
const dns = require('dns');
|
||||
const dnsPromises = dns.promises;
|
||||
|
||||
let verbatim;
|
||||
|
||||
// We want to test the parameter of verbatim only so that we
|
||||
// ignore possible errors here.
|
||||
function allowFailed(fn) {
|
||||
return fn.catch((_err) => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
let callsLength = 0;
|
||||
const checkParameter = (expected) => {
|
||||
assert.strictEqual(calls.length, callsLength + 1);
|
||||
verbatim = calls[callsLength][4];
|
||||
assert.strictEqual(verbatim, expected);
|
||||
callsLength += 1;
|
||||
};
|
||||
|
||||
await allowFailed(promisify(dns.lookup)('example.org'));
|
||||
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
|
||||
|
||||
await allowFailed(dnsPromises.lookup('example.org'));
|
||||
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
|
||||
|
||||
await allowFailed(promisify(dns.lookup)('example.org', {}));
|
||||
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
|
||||
|
||||
await allowFailed(dnsPromises.lookup('example.org', {}));
|
||||
checkParameter(cares.DNS_ORDER_IPV4_FIRST);
|
||||
})().then(common.mustCall());
|
||||
@@ -1,51 +0,0 @@
|
||||
// Flags: --expose-internals --dns-result-order=verbatim
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const cares = internalBinding('cares_wrap');
|
||||
const { promisify } = require('util');
|
||||
|
||||
// Test that --dns-result-order=verbatim works as expected.
|
||||
|
||||
const originalGetaddrinfo = cares.getaddrinfo;
|
||||
const calls = [];
|
||||
cares.getaddrinfo = common.mustCallAtLeast((...args) => {
|
||||
calls.push(args);
|
||||
originalGetaddrinfo(...args);
|
||||
}, 1);
|
||||
|
||||
const dns = require('dns');
|
||||
const dnsPromises = dns.promises;
|
||||
|
||||
let verbatim;
|
||||
|
||||
// We want to test the parameter of verbatim only so that we
|
||||
// ignore possible errors here.
|
||||
function allowFailed(fn) {
|
||||
return fn.catch((_err) => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
let callsLength = 0;
|
||||
const checkParameter = (expected) => {
|
||||
assert.strictEqual(calls.length, callsLength + 1);
|
||||
verbatim = calls[callsLength][4];
|
||||
assert.strictEqual(verbatim, expected);
|
||||
callsLength += 1;
|
||||
};
|
||||
|
||||
await allowFailed(promisify(dns.lookup)('example.org'));
|
||||
checkParameter(cares.DNS_ORDER_VERBATIM);
|
||||
|
||||
await allowFailed(dnsPromises.lookup('example.org'));
|
||||
checkParameter(cares.DNS_ORDER_VERBATIM);
|
||||
|
||||
await allowFailed(promisify(dns.lookup)('example.org', {}));
|
||||
checkParameter(cares.DNS_ORDER_VERBATIM);
|
||||
|
||||
await allowFailed(dnsPromises.lookup('example.org', {}));
|
||||
checkParameter(cares.DNS_ORDER_VERBATIM);
|
||||
})().then(common.mustCall());
|
||||
Reference in new issue
Block a user