test: tighten transport, recovery, and diagnostic checks (#33559)

* test: tighten transport, recovery, and diagnostic checks

* test: use at for last mock socket access

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-25 08:11:25 -07:00
committed by GitHub
co-authored by OrcaWin
parent 33c76d89f1
commit cc0e35ebcc
19 changed files with 319 additions and 210 deletions
@@ -16,11 +16,11 @@ describe('withSelectedTabs', () => {
it('keeps a selection the move did not touch', () => {
const before = [
{ id: 'g1', activeTabId: 'a', tabOrder: ['a', 'b'] },
{ id: 'g1', activeTabId: 'a', tabOrder: ['d', 'a', 'b'] },
{ id: 'g2', activeTabId: 'c', tabOrder: ['c'] }
]
const after = [
{ id: 'g1', tabOrder: ['a'] },
{ id: 'g1', tabOrder: ['d', 'a'] },
{ id: 'g2', tabOrder: ['b', 'c'] }
]
expect(withSelectedTabs(before, after, 'b').map((group) => group.activeTabId)).toEqual([
@@ -17,6 +17,7 @@ const { OrcaRuntimeService } = await import('./orca-runtime-test-mocks.spec')
await import('./orca-runtime-test-lifecycle.spec')
const {
HEADLESS_LEAF_ID,
makeDeferred,
TEST_WORKTREE_ID,
makeRuntimeStoreWithWorkspaceSession,
makeWorkspaceSessionWithHeadlessTerminal
@@ -80,7 +81,22 @@ describe("a paired desktop's Reopen of a held pane (layout-owner build)", () =>
const { runtime, spawn } = await heldPaneRuntime()
expect(publishedStatus(runtime)).toBe('held')
await expect(runtime.reopenHeldTerminalPanes([PANE])).resolves.toEqual({ reopened: true })
const stopStarted = makeDeferred()
const stopFinished = makeDeferred()
daemonHold.reopen.mockImplementationOnce(async () => {
stopStarted.resolve()
await stopFinished.promise
return { reopened: true }
})
const reopening = runtime.reopenHeldTerminalPanes([PANE])
await stopStarted.promise
try {
expect(spawn).toHaveBeenCalledOnce()
expect(publishedStatus(runtime)).toBe('held')
} finally {
stopFinished.resolve()
}
await expect(reopening).resolves.toEqual({ reopened: true })
expect(daemonHold.reopen).toHaveBeenCalledOnce()
expect(spawn).toHaveBeenCalledTimes(2)