test: allow numeric string for lookupService test
Fixes: https://github.com/nodejs/node/issues/42164 If the given port number isn't associated with any service name, the `service` resolved from `dns.lookupService` can be a numeric string representing the port number. PR-URL: https://github.com/nodejs/node/pull/42596 Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
parent
35d72bf4ec
commit
db7fa9f4b7
@ -6,7 +6,7 @@ const assert = require('assert');
|
||||
const dnsPromises = require('dns').promises;
|
||||
|
||||
dnsPromises.lookupService('127.0.0.1', 22).then(common.mustCall((result) => {
|
||||
assert.strictEqual(result.service, 'ssh');
|
||||
assert(['ssh', '22'].includes(result.service));
|
||||
assert.strictEqual(typeof result.hostname, 'string');
|
||||
assert.notStrictEqual(result.hostname.length, 0);
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user