test(web): guard bootstrap timer cleanup across attempts

Slow-start recovery is advertised to preview users. Pin cleanup when the loading fallback unmounts and ensure a later attempt does not inherit the previous warning deadline. This guards existing UX without changing product behaviour; 34 focused bootstrap, connection badge and runtime tests pass.

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-09-08 01:52:20 +01:00
parent 103076c65b
commit d44c6282de
@@ -34,4 +34,24 @@ describe('AppBootstrapStatus', () => {
fireEvent.click(retry);
expect(onRetry).toHaveBeenCalledOnce();
});
it('cancels a completed bootstrap timer and gives a fresh attempt its full waiting period', async () => {
vi.useFakeTimers();
const first = render(() => <AppBootstrapStatus />);
await vi.advanceTimersByTimeAsync(APP_BOOTSTRAP_SLOW_DELAY_MS - 1);
expect(screen.queryByRole('button', { name: 'Retry connection' })).toBeNull();
first.unmount();
expect(vi.getTimerCount()).toBe(0);
render(() => <AppBootstrapStatus />);
await vi.advanceTimersByTimeAsync(1);
expect(screen.getByRole('status')).toHaveTextContent(
'Checking your session and preparing the workspace.',
);
expect(screen.queryByRole('button', { name: 'Retry connection' })).toBeNull();
await vi.advanceTimersByTimeAsync(APP_BOOTSTRAP_SLOW_DELAY_MS - 1);
expect(screen.getByRole('button', { name: 'Retry connection' })).toBeVisible();
});
});