Skip to content

Commit

Permalink
test: add missing test coverage for setLocalAddress()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Trott authored and targos committed May 1, 2021
1 parent ffaa114 commit 16f6f1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/parallel/test-dns-setlocaladdress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 16f6f1a

Please sign in to comment.