test(activity): tighten readiness regression coverage

This commit is contained in:
Neil
2026-07-29 02:29:25 -07:00
parent 4e49b99b53
commit 9a2b2fb1dd
2 changed files with 6 additions and 4 deletions
@@ -55,7 +55,10 @@ import {
reconcileActivityPortalThreads,
resolveActivityPortalSwap
} from './activity-portal-thread-reconciliation'
import { createActivityPortalReadinessLatch } from './activity-portal-readiness-oscillation'
import {
createActivityPortalReadinessLatch,
type ActivityPortalReadinessStatus
} from './activity-portal-readiness-oscillation'
import type { Repo, TerminalTab, Worktree } from '../../../../shared/types'
import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants'
import {
@@ -136,7 +139,7 @@ type ActivityThreadGroup = {
type ActivityTerminalPortalReadiness = {
target: HTMLElement | null
paneKey: string | null
status: 'loading' | 'ready' | 'unavailable'
status: ActivityPortalReadinessStatus
}
type ActivityTerminalPortalDomStatus = {
@@ -363,7 +366,6 @@ export function useActivityTerminalPortalStatus(
updateReadiness('loading')
}
updateReadiness('loading')
checkReadiness()
const observer = new MutationObserver(checkReadiness)
@@ -72,7 +72,7 @@ describe('Activity portal readiness subscription churn', () => {
expect(renders).toBeLessThanOrEqual(31)
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 30))
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
})
expect(status).toBe('unavailable')
expect(renders).toBeLessThanOrEqual(32)