Skip to content

SR-233: Fix WebSocketToastNotifications tests that exercise a component that doesn't exist #1376

Description

@richardiyamura

Problem

frontend/src/components/__tests__/WebSocketToastNotifications.test.tsx (431 lines, 12 tests) mocks socket.io-client's io() and asserts toast behavior — but there is no WebSocketToastNotifications component anywhere in frontend/src/components/. Every test defines its own local TestComponent inline that wires mockSocket.on('remittance:completed', ...) directly to useToast()/ToastContainer. This suite tests a throwaway scratch harness, not production code — it gives a false signal of coverage for real-time UI updates.

Meanwhile, the actual production real-time status component, frontend/src/components/TransactionStatusTracker.tsx, uses the native WebSocket API, not socket.io-client. Its test file has zero references to WebSocket or socket — it only covers polling and API-fetch paths. The component's actual open/message/error/close event handling, and its malformed-payload catch block, are completely untested.

Suggested approach

  1. Either delete/rename WebSocketToastNotifications.test.tsx to reflect that it's testing a generic toast+socket pattern, or wire it to a real component if one is intended to exist.
  2. Add tests to TransactionStatusTracker.test.tsx that construct the component with a mocked/fake WebSocket, and assert: status updates on message, graceful handling of malformed JSON payloads, and cleanup (close) on unmount.

Metadata

Metadata

Assignees

Labels

P2ImportantStellar WaveIssues in the Stellar wave programTestingbugSomething isn't workingfrontend

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions