From 16f6f1a0c22c1608450676d78ca193564ac02f10 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 8 Nov 2020 06:50:50 -0800 Subject: [PATCH] test: add missing test coverage for setLocalAddress() Add missing coverage for setLocalAddress() method of dns.Resolver class. The case where a valid IPv4 argument was supplied along with an invalid IPv6 argument was not being checked. Refs: https://coverage.nodejs.org/coverage-85b42af4398073f8/lib/internal/dns/utils.js.html#L124 PR-URL: https://github.com/nodejs/node/pull/36039 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson --- test/parallel/test-dns-setlocaladdress.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-dns-setlocaladdress.js b/test/parallel/test-dns-setlocaladdress.js index 2e39f3bf910aa7..25bece328f4a74 100644 --- a/test/parallel/test-dns-setlocaladdress.js +++ b/test/parallel/test-dns-setlocaladdress.js @@ -27,7 +27,10 @@ const promiseResolver = new dns.promises.Resolver(); }, Error); assert.throws(() => { resolver.setLocalAddress(123); - }, Error); + }, { code: 'ERR_INVALID_ARG_TYPE' }); + assert.throws(() => { + resolver.setLocalAddress('127.0.0.1', 42); + }, { code: 'ERR_INVALID_ARG_TYPE' }); assert.throws(() => { resolver.setLocalAddress(); }, Error);