From 303152520a73b5f6d2d9b2e36998f388af8fe71b Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Sat, 2 Apr 2022 19:42:42 +0900 Subject: [PATCH] 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. --- test/parallel/test-dns-lookupService-promises.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-dns-lookupService-promises.js b/test/parallel/test-dns-lookupService-promises.js index d7e50f194da8a1..450975f72f4ae1 100644 --- a/test/parallel/test-dns-lookupService-promises.js +++ b/test/parallel/test-dns-lookupService-promises.js @@ -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'].some((x) => x === result.service)); assert.strictEqual(typeof result.hostname, 'string'); assert.notStrictEqual(result.hostname.length, 0); }));