From b8cdd1502f8aac54b8c93fdc142d89c3eb9d97e7 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 PR-URL: https://github.com/nodejs/node/pull/46910 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Yagiz Nizipli --- test/parallel/test-dns.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index b324723ce9a8f4..40866d4718281a 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -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('', { @@ -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 });