Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix node 19.1.0 port validation test #4427

Merged
merged 3 commits into from Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/server.test.js
Expand Up @@ -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')
}
})