Skip to content

Commit

Permalink
remove test
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Mar 2, 2024
1 parent 827cffc commit d096575
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions test/websocket/close.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { describe, test, after } = require('node:test')
const assert = require('node:assert')
const { WebSocketServer } = require('ws')
const { WebSocket } = require('../..')
const { kReadyState } = require('../../lib/web/websocket/symbols')

describe('Close', () => {
test('Close with code', () => {
Expand Down Expand Up @@ -152,31 +151,4 @@ describe('Close', () => {

await t.completed
})

test('calling close when connection is open but close handshake has started does not result in sending the handshake again', async (t) => {
t = tspl(t, { plan: 1 })

const server = new WebSocketServer({ port: 0 })

after(() => server.close())

server.on('connection', (ws) => {
ws.on('close', (code) => {
t.strictEqual(code, 1000)
})
})

const ws = new WebSocket(`ws://localhost:${server.address().port}`)
ws.addEventListener('open', () => {
// .close() will start the close handshake and set the readyState to
// CLOSING
ws.close(1000)
// set the readyState to OPEN to simulate the close handshake being
// started but not yet completed
ws[kReadyState] = ws.OPEN
ws.close(1000)
})

await t.completed
})
})

0 comments on commit d096575

Please sign in to comment.