Skip to content

Commit

Permalink
chore: add test related to nodejs#3546
Browse files Browse the repository at this point in the history
Signed-off-by: eXhumer <[email protected]>
  • Loading branch information
eXhumer committed Sep 5, 2024
1 parent a0e1f8e commit e7beb86
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/websocket/issue-3546.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'

const { test } = require('node:test')
const { WebSocket } = require('../..')
const { tspl } = require('@matteo.collina/tspl')

test('close is fired on failed connection', async (t) => {
const { completed, deepStrictEqual } = tspl(t, { plan: 1 })
const ws = new WebSocket('ws://localhost:1')

ws.addEventListener('close', () => {
deepStrictEqual(ws.readyState, WebSocket.CLOSED)
})

await completed
})

0 comments on commit e7beb86

Please sign in to comment.