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 <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
Trott authored and targos committed Nov 14, 2020
1 parent b1f5518 commit df21120
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 df21120

Please sign in to comment.