Files
archived-orca/src/main/runtime/pty-exit-record-wait.test.ts
T
ad2156c358 test: remove 140 low-value cases and 49 suites (#34062)
* test: remove 140 low-value cases and redundant browser probes

* fix: remove unused upstream chat menu import

* test: pin the host-split layout fixture branch

---------

Co-authored-by: Orca Test Audit <test-audit@stably.ai>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-10-26 15:16:27 -07:00

31 lines
1.1 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest'
import { OrcaRuntimeService } from './orca-runtime'
const PTY_ID = 'repo::/tmp/exit-record-wait@@pty'
const WORKTREE_ID = 'repo::/tmp/exit-record-wait'
afterEach(() => {
vi.useRealTimers()
})
describe('waitForPtyExitRecord', () => {
it('resolves true once the exit reaches the runtime record', async () => {
const runtime = new OrcaRuntimeService()
runtime.registerPty(PTY_ID, WORKTREE_ID, null)
const wait = runtime.waitForPtyExitRecord(PTY_ID, 10_000)
runtime.onPtyExit(PTY_ID, 0)
await expect(wait).resolves.toBe(true)
expect(runtime.getPtyLivenessVerdict(PTY_ID)).toEqual({ status: 'exited' })
})
it('resolves false when no exit arrives within the budget', async () => {
vi.useFakeTimers()
const runtime = new OrcaRuntimeService()
runtime.registerPty(PTY_ID, WORKTREE_ID, null)
const wait = runtime.waitForPtyExitRecord(PTY_ID, 1_000)
await vi.advanceTimersByTimeAsync(1_000)
await expect(wait).resolves.toBe(false)
runtime.onPtyExit(PTY_ID, 0)
})
})