Skip to content

test(ws): WebSocket subscription tests (#105)#127

Open
Nuel-ship-it wants to merge 1 commit into
Miracle656:mainfrom
Nuel-ship-it:issue-105-websocket-tests
Open

test(ws): WebSocket subscription tests (#105)#127
Nuel-ship-it wants to merge 1 commit into
Miracle656:mainfrom
Nuel-ship-it:issue-105-websocket-tests

Conversation

@Nuel-ship-it

Copy link
Copy Markdown
Contributor

Summary

Closes #105

Adds tests/integration/ws.test.ts — a self-contained Jest test suite for the /subscribe/:address WebSocket endpoint. No Docker or database required; the suite spins up a real http.createServer + attachWebSocketServer in-process.

Tests

Test Covers
Rejects upgrade on unknown path 404 / socket destroy path
Connects and receives a matching transfer connect / sub / recv cycle
Receives outgoing transfers (sender match) fromAddress filter branch
Does not forward transfers for a different address address isolation
Connect / subscribe / receive / disconnect cycle — cleans up listener clean disconnect, no dangling emitter
Backpressure — 50 rapid messages without error fast-producer / slow-consumer buffering

Acceptance criteria

  • Connect/sub/recv/disc cycle works
  • Backpressure on slow client tested

Verified

PASS  tests/integration/ws.test.ts (7.302 s)
  WebSocket /subscribe/:address
    ✓ rejects upgrade on unknown path with 404
    ✓ connects and receives a matching transfer
    ✓ receives outgoing transfers (sender match)
    ✓ does not forward transfers for a different address
    ✓ connect / subscribe / receive / disconnect cycle — cleans up listener
    ✓ backpressure — buffers many rapid messages without error

Tests: 6 passed, 6 total

- connect/subscribe/receive/disconnect cycle
- address filtering (toAddress and fromAddress)
- rejects upgrade on invalid path
- backpressure: 50 rapid messages buffered without error
- listener cleanup verified after disconnect
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Nuel-ship-it Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket subscription tests

1 participant