From 36d84bce78f2d4b2bc8255c1432160d49776e8fe Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Fri, 18 Nov 2022 10:25:58 +0100 Subject: [PATCH] fix node 19.1.0 port validation test (#4427) * fix node 19.1.0 port validation test * Apply suggestions from code review * check for ERR_SOCKET_BAD_PORT --- test/server.test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/server.test.js b/test/server.test.js index 5919491430..70dd5a915b 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -36,19 +36,18 @@ test('listen should accept stringified number port', t => { test('listen should reject string port', async (t) => { t.plan(2) - const fastify = Fastify() t.teardown(fastify.close.bind(fastify)) try { await fastify.listen({ port: 'hello-world' }) } catch (error) { - t.same(error.message, 'options.port should be >= 0 and < 65536. Received hello-world.') + t.equal(error.code, 'ERR_SOCKET_BAD_PORT') } try { await fastify.listen({ port: '1234hello' }) } catch (error) { - t.same(error.message, 'options.port should be >= 0 and < 65536. Received 1234hello.') + t.equal(error.code, 'ERR_SOCKET_BAD_PORT') } })