Skip to content

Commit

Permalink
test: improve test coverage of lib/dns
Browse files Browse the repository at this point in the history
PR-URL: #46910
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
paivaandeerson authored and targos committed Mar 14, 2023
1 parent f903ea5 commit acfd9b8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/parallel/test-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ assert.throws(() => dns.lookup('nodejs.org', 4), {
name: 'TypeError'
});

assert.throws(() => dns.lookup('', {
family: 'nodejs.org',
hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL,
}), {
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError'
});

dns.lookup('', { family: 4, hints: 0 }, common.mustCall());

dns.lookup('', {
Expand All @@ -264,6 +272,16 @@ dns.lookup('', {
hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL
}, common.mustCall());

dns.lookup('', {
hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL,
family: 'IPv4'
}, common.mustCall());

dns.lookup('', {
hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL,
family: 'IPv6'
}, common.mustCall());

(async function() {
await dnsPromises.lookup('', { family: 4, hints: 0 });
await dnsPromises.lookup('', { family: 6, hints: dns.ADDRCONFIG });
Expand Down

0 comments on commit acfd9b8

Please sign in to comment.