Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive WebSocket test coverage to reach 83% coverage in websocket.js. The tests focus on public endpoints, with private endpoint testing deferred to when testnet is available.
Key changes:
- Added unit tests for user event transformations (account updates, execution reports, list status, balance updates)
- Added integration tests for public WebSocket streams (trades, tickers, depth, candles, book tickers, mark prices, liquidations)
- Implemented tests for both raw and transformed data formats, including cleanup function verification
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/websockets/user.js | Tests for user event handler transformations of private stream events |
| test/websockets/trades.js | Tests for trade and aggregated trade streams |
| test/websockets/ticker.js | Tests for 24hr ticker and mini ticker streams |
| test/websockets/markPrices.js | Tests for futures mark price streams |
| test/websockets/liquidations.js | Tests for futures liquidation streams (skipped) |
| test/websockets/depth.js | Tests for order book depth streams |
| test/websockets/customSubStream.js | Tests for custom stream subscriptions |
| test/websockets/candles.js | Tests for candlestick/kline streams |
| test/websockets/bookTicker.js | Tests for best bid/ask order book ticker streams |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| import { userEventHandler } from 'websocket' | ||
|
|
||
| // TODO: add testnet to be able to test private ws endpoints |
There was a problem hiding this comment.
Corrected spelling of 'converage' to 'coverage' in the PR description.
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.
Reached 83% test converage in websocket.js
In the future should add testnet to also add proper tests to private endpoints