refactor: extract socket loop into its own module, move e2e tests to tests/ - #19
Merged
Merged
Conversation
…tests/ Split lib.rs along its two natural seams. lib.rs now holds only the public Socketeer handle (connect/send/receive/reconnect/close); the background task that owns the split WebSocket stream moves to src/socket_loop.rs. The handle's entire contract with the loop is now expressed through three pub(crate) items (TxChannelPayload, send_close, socket_loop_split) plus the shared WebSocketStreamType alias. The ~580 lines of end-to-end tests, which only ever touched the public API and the mocking exports, move to tests/integration.rs as integration tests. The genuine unit tests in codec.rs stay inline. Also folds in the trace-level normalization discussed alongside this work, since those lines were relocated by the extraction: routine keepalive sends info -> trace, per-message send debug -> trace (matching the receive side), and the expected reconnect close-failure error -> debug. No behavior change. All tests pass (15 unit, 25 integration, 5 doc); clippy pedantic and rustfmt clean.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
==========================================
- Coverage 98.52% 97.05% -1.47%
==========================================
Files 5 6 +1
Lines 811 408 -403
==========================================
- Hits 799 396 -403
Misses 12 12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split lib.rs along its two natural seams. lib.rs now holds only the public
Socketeer handle (connect/send/receive/reconnect/close); the background task
that owns the split WebSocket stream moves to src/socket_loop.rs. The handle's
entire contract with the loop is now expressed through three pub(crate) items
(TxChannelPayload, send_close, socket_loop_split) plus the shared
WebSocketStreamType alias.
The ~580 lines of end-to-end tests, which only ever touched the public API and
the mocking exports, move to tests/integration.rs as integration tests. The
genuine unit tests in codec.rs stay inline.
Also folds in the trace-level normalization discussed alongside this work,
since those lines were relocated by the extraction: routine keepalive sends
info -> trace, per-message send debug -> trace (matching the receive side), and
the expected reconnect close-failure error -> debug.
No behavior change. All tests pass (15 unit, 25 integration, 5 doc); clippy
pedantic and rustfmt clean.