test: align hook notification fixtures with mobile delivery

This commit is contained in:
Jinwoo-H
2026-09-07 18:55:37 -04:00
parent 761d2a046c
commit d1b3ae8086
3 changed files with 10 additions and 3 deletions
@@ -12,7 +12,7 @@ type MockStoreState = {
settings: {
experimentalTerminalAttention: boolean
notifications: { enabled: boolean; agentTaskComplete: boolean }
}
} | null
ptyIdsByTabId: Record<string, string[]>
suppressedPtyExitIds: Record<string, boolean>
tabsByWorktree: Record<string, { id: string; ptyId: string }[]>
@@ -71,12 +71,14 @@ describe('agent hook completion fresh-working gate', () => {
afterEach(() => vi.useRealTimers())
it('stays gated through a stamped working completion after re-enable', async () => {
it('waits for fresh working after settings hydration before dispatching completion', async () => {
const {
observeAgentHookCompletionForNotification,
syncAgentHookCompletionNotificationSettings
} = await import('./agent-hook-completion-notifications')
const hydratedSettings = mockStoreState.settings
mockStoreState.settings = null
syncAgentHookCompletionNotificationSettings()
observeAgentHookCompletionForNotification({
paneKey: PANE_KEY,
@@ -84,7 +86,7 @@ describe('agent hook completion fresh-working gate', () => {
payload: { ...working(), stateStartedAt: 1_000 }
})
mockStoreState.settings.notifications.agentTaskComplete = true
mockStoreState.settings = hydratedSettings
syncAgentHookCompletionNotificationSettings()
observeAgentHookCompletionForNotification({
paneKey: PANE_KEY,
@@ -167,6 +167,10 @@ export function buildStoreState(overrides: StoreLike): StoreLike {
updateTabTitles: vi.fn(),
runtimePaneTitlesByTabId: {},
terminalLayoutsByTabId: {},
ptyIdsByTabId: {},
suppressedPtyExitIds: {},
markWorktreeUnread: vi.fn(),
markAgentCompletionPaneUnread: vi.fn(),
agentStatusByPaneKey: {},
setAgentStatuses: vi.fn(() => []),
recordAgentProviderSession: vi.fn(),
@@ -127,6 +127,7 @@ export function buildWindowApi(args: {
onDetectedPortsChanged: () => () => {},
...args.ssh
},
notifications: { dispatch: vi.fn(async () => ({ delivered: false })) },
agentStatus: {
onSet: args.onSet,
onClear: args.onClear ?? vi.fn(() => () => {}),