Files
archived-orca/src/main/runtime/construction/worktree-rows-change-events.test.ts
T
Kelvin Amoaba 81c97bb124 perf(runtime): push worktree row changes; host list poll becomes a 10 s backstop (#39688)
* perf(runtime): push worktree row changes; host list poll becomes a 10 s backstop

* fix(runtime): announce title-only agent status changes and gate the rows capability with the switch

* fix(mobile): keep event reads a floor apart while a read is out; announce a retired title clear

* test(runtime): assert the rows notice without counting events
2026-11-08 06:42:18 +00:00

31 lines
1.0 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import { AgentHookServer } from '../../agent-hooks/server'
import { OrcaRuntimeService } from '../orca-runtime'
describe('worktreeRowsChanged', () => {
afterEach(() => {
vi.useRealTimers()
})
it('tells clients when an agent row changes', () => {
vi.useFakeTimers()
const runtime = new OrcaRuntimeService()
const server = new AgentHookServer()
const detach = runtime.attachAgentStatusStore(server)
const events: RuntimeClientEvent[] = []
runtime.onClientEvent((event) => events.push(event))
server.ingestTerminalStatus({
paneKey: 'tab-1:22222222-2222-4222-8222-222222222222',
tabId: 'tab-1',
worktreeId: 'repo-1::/tmp/worktree-a',
payload: { state: 'working', prompt: 'task', agentType: 'claude' }
})
vi.advanceTimersByTime(500)
expect(events).toContainEqual({ type: 'worktreeRowsChanged' })
detach()
})
})