Skip to content

Commit 16f6f1a

Browse files
Trotttargos
authored andcommitted
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: #36039 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent ffaa114 commit 16f6f1a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: test/parallel/test-dns-setlocaladdress.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ const promiseResolver = new dns.promises.Resolver();
2727
}, Error);
2828
assert.throws(() => {
2929
resolver.setLocalAddress(123);
30-
}, Error);
30+
}, { code: 'ERR_INVALID_ARG_TYPE' });
31+
assert.throws(() => {
32+
resolver.setLocalAddress('127.0.0.1', 42);
33+
}, { code: 'ERR_INVALID_ARG_TYPE' });
3134
assert.throws(() => {
3235
resolver.setLocalAddress();
3336
}, Error);

0 commit comments

Comments
 (0)