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

feat: port websocket tests to node test runner #2553

Merged
merged 13 commits into from
Dec 30, 2023
Prev Previous commit
Next Next commit
fix: fragments
  • Loading branch information
ilteoood committed Dec 28, 2023
commit f57d83391cdb285aa38296cad35d0fa3e0b9845d
15 changes: 9 additions & 6 deletions test/websocket/fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ test('Fragmented frame with a ping frame in the middle of it', () => {

const ws = new WebSocket(`ws://localhost:${server.address().port}`)

ws.addEventListener('message', ({ data }) => {
assert.strictEqual(data, 'Hello')

ws.close()
})

diagnosticsChannel.channel('undici:websocket:ping').subscribe(
({ payload }) => assert.deepStrictEqual(payload, Buffer.from('Hello'))
)

return new Promise((resolve) => {
ws.addEventListener('message', ({ data }) => {
assert.strictEqual(data, 'Hello')

ws.close()
resolve()
})
})
})
Loading