From aa8e92f516e3225e008bccbdf048449dc5003513 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 15 Aug 2026 00:11:57 -0700 Subject: [PATCH] test: pin document.hasFocus in status timer test (useViewedInterval gating) --- .../src/components/assistant-ui/thread/status.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx b/apps/desktop/src/components/assistant-ui/thread/status.test.tsx index e51f39313a..51604b4dc4 100644 --- a/apps/desktop/src/components/assistant-ui/thread/status.test.tsx +++ b/apps/desktop/src/components/assistant-ui/thread/status.test.tsx @@ -19,6 +19,10 @@ describe('ResponseLoadingIndicator timer', () => { beforeEach(() => { vi.useFakeTimers() vi.setSystemTime(new Date('2026-01-01T00:00:00.000Z')) + // useViewedInterval gates ticking on document focus + visibility; jsdom's + // hasFocus() is unreliable across runners, so pin it (same as the + // background-sync backstop tests). + vi.spyOn(document, 'hasFocus').mockReturnValue(true) __resetElapsedTimerRegistryForTests() }) @@ -27,6 +31,7 @@ describe('ResponseLoadingIndicator timer', () => { $activeSessionId.set(null) $turnStartedAt.set(null) __resetElapsedTimerRegistryForTests() + vi.restoreAllMocks() vi.useRealTimers() })