fix: wrap mockOnClose in act() to fix flaky LiveLogViewer test

Fixes race condition where WebSocket disconnect event wasn't being
processed within React's rendering cycle, causing intermittent CI
failures. Wrapping mockOnClose() in act() ensures React state updates
are flushed before assertions run.

Resolves #237
This commit is contained in:
GitHub Actions
2025-12-14 03:37:37 +00:00
parent caf3e0340d
commit 926c4e239b

View File

@@ -321,7 +321,9 @@ describe('LiveLogViewer', () => {
await waitFor(() => expect(screen.getByText('Connected')).toBeTruthy());
mockOnClose?.();
act(() => {
mockOnClose?.();
});
await waitFor(() => expect(screen.getByText('Disconnected')).toBeTruthy());
});