Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: check arg type for dnsPromises.resolve to increase coverage.
  • Loading branch information
Masashi Hirano committed Aug 5, 2018
commit cbec2843361f86e43d8dc780982b0098526d4d9a
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