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:
@@ -321,7 +321,9 @@ describe('LiveLogViewer', () => {
|
||||
|
||||
await waitFor(() => expect(screen.getByText('Connected')).toBeTruthy());
|
||||
|
||||
mockOnClose?.();
|
||||
act(() => {
|
||||
mockOnClose?.();
|
||||
});
|
||||
|
||||
await waitFor(() => expect(screen.getByText('Disconnected')).toBeTruthy());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user