Skip to content

The agent that grows with you

test: pin document.hasFocus in status timer test (useViewedInterval gating)

Tekniumaa8e92f516e3
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 e51f39313a7..51604b4dc4b 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()
})