Files
orca/tests/e2e/helpers/streaming-terminal-cleanup.unit.test.ts
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

30 lines
1.1 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { closeStreamingTerminals } from './streaming-terminal-cleanup'
describe('closeStreamingTerminals', () => {
it('force-closes a streaming PTY when tab cleanup fails', async () => {
const call = vi.fn(async (method: string, terminal: string) => {
if (method === 'terminal.closeTab' && terminal === 'term_a') {
throw new Error('renderer unavailable')
}
})
await expect(closeStreamingTerminals(['term_a', 'term_b'], call)).resolves.toBeUndefined()
expect(call).toHaveBeenCalledWith('terminal.closeTab', 'term_a')
expect(call).toHaveBeenCalledWith('terminal.close', 'term_a')
expect(call).toHaveBeenCalledWith('terminal.closeTab', 'term_b')
})
it('waits for every fallback and reports terminals that could not be stopped', async () => {
const call = vi.fn(async () => {
throw new Error('runtime frozen')
})
await expect(closeStreamingTerminals(['term_a', 'term_b'], call)).rejects.toThrow(
'Failed to close 2 streaming terminal(s)'
)
expect(call).toHaveBeenCalledTimes(4)
})
})