Simplify HQ websocket functions#469
Conversation
Also add unit tests for `handleConfirmedMsg`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #469 +/- ##
==========================================
+ Coverage 55.33% 56.45% +1.12%
==========================================
Files 128 130 +2
Lines 7939 8052 +113
==========================================
+ Hits 4393 4546 +153
+ Misses 3183 3145 -38
+ Partials 363 361 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the HQ websocket functions by reducing struct declaration overhead and adds unit test coverage for the handleConfirmedMsg function. The changes focus on making the code more concise while ensuring proper test coverage.
Key changes:
- Inline struct declarations to replace named struct types in websocket message handlers
- Add comprehensive unit tests for
handleConfirmedMsgfunction with valid JSON, invalid JSON, and extra fields scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/pkg/source/hq/websocket.go | Simplifies message handling by using inline struct declarations instead of named types |
| internal/pkg/source/hq/websocket_test.go | Adds new unit tests for handleConfirmedMsg function with multiple test scenarios |
Comments suppressed due to low confidence (1)
internal/pkg/source/hq/websocket.go:1
- The
loggervariable is not defined in thelistenMessagesfunction scope. This will cause a compilation error sinceloggeris only defined in thewebsocketfunction.
package hq
Also add unit tests for
handleConfirmedMsg.