From 35e6fc9b302c19db556b490d163c4f0dd28e418d Mon Sep 17 00:00:00 2001 From: Anderson Paiva Date: Thu, 23 Feb 2023 17:55:50 -0300 Subject: [PATCH] test: improve test coverage of lib/dns --- test/parallel/test-dns.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index b324723ce9a8f4..e1daa9021f9e46 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -239,6 +239,15 @@ 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', + message: 'The "callback" argument must be of type function. Received undefined' +}); + dns.lookup('', { family: 4, hints: 0 }, common.mustCall()); dns.lookup('', { @@ -264,6 +273,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 });