Skip to content

Commit

Permalink
test: check arg type for dnsPromises.resolve
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Masashi Hirano authored and targos committed Aug 11, 2018
1 parent 9d80199 commit 9d85a05
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions test/parallel/test-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 9d85a05

Please sign in to comment.