test: check arg type for dnsPromises.resolve
PR-URL: https://github.com/nodejs/node/pull/22000 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
a4c1cf5f86
commit
0b85435c01
@ -135,14 +135,31 @@ assert.deepStrictEqual(dns.getServers(), portsExpected);
|
||||
dns.setServers([]);
|
||||
assert.deepStrictEqual(dns.getServers(), []);
|
||||
|
||||
common.expectsError(() => {
|
||||
dns.resolve('example.com', [], common.mustNotCall());
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "rrtype" argument must be of type string. ' +
|
||||
'Received type object'
|
||||
});
|
||||
{
|
||||
const errObj = {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "rrtype" argument must be of type string. ' +
|
||||
'Received type object'
|
||||
};
|
||||
common.expectsError(() => {
|
||||
dns.resolve('example.com', [], common.mustNotCall());
|
||||
}, errObj);
|
||||
common.expectsError(() => {
|
||||
dnsPromises.resolve('example.com', []);
|
||||
}, errObj);
|
||||
}
|
||||
{
|
||||
const errObj = {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "name" argument must be of type string. ' +
|
||||
'Received type undefined'
|
||||
};
|
||||
common.expectsError(() => {
|
||||
dnsPromises.resolve();
|
||||
}, errObj);
|
||||
}
|
||||
|
||||
// dns.lookup should accept only falsey and string values
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user