mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
test(relay): treat minted PTY ids as opaque
This commit is contained in:
@@ -159,16 +159,20 @@ describe('relay PTY output drain — differential vs the pre-optimization snapsh
|
||||
async function spawnPtys(count: number): Promise<string[]> {
|
||||
const ids: string[] = []
|
||||
for (let i = 0; i < count; i++) {
|
||||
let dataCallback!: (data: string) => void
|
||||
let exitCallback!: (event: { exitCode: number }) => void
|
||||
mockPtySpawn.mockReturnValueOnce({
|
||||
...mockPtyInstance,
|
||||
onData: vi.fn((cb: (data: string) => void) => {
|
||||
dataCallbacks.set(`pty-${i + 1}`, cb)
|
||||
dataCallback = cb
|
||||
}),
|
||||
onExit: vi.fn((cb: (event: { exitCode: number }) => void) => {
|
||||
exitCallbacks.set(`pty-${i + 1}`, cb)
|
||||
exitCallback = cb
|
||||
})
|
||||
})
|
||||
const spawned = (await dispatcher.callRequest('pty.spawn', {})) as { id: string }
|
||||
dataCallbacks.set(spawned.id, dataCallback)
|
||||
exitCallbacks.set(spawned.id, exitCallback)
|
||||
ids.push(spawned.id)
|
||||
}
|
||||
return ids
|
||||
|
||||
@@ -204,7 +204,7 @@ describe('Subprocess: Relay entry point', () => {
|
||||
const repairedId = relay.send('pty.spawn', { cols: 80, rows: 24 })
|
||||
const repaired = await relay.waitForResponse(repairedId)
|
||||
expect(repaired.error).toBeUndefined()
|
||||
expect(repaired.result).toMatchObject({ id: 'pty-1' })
|
||||
expect(repaired.result).toMatchObject({ id: expect.any(String) })
|
||||
}, 10_000)
|
||||
|
||||
it('reloads node-pty after a late native binding failure without restarting', async () => {
|
||||
@@ -228,7 +228,7 @@ describe('Subprocess: Relay entry point', () => {
|
||||
const repairedId = relay.send('pty.spawn', { cols: 80, rows: 24 })
|
||||
const repaired = await relay.waitForResponse(repairedId)
|
||||
expect(repaired.error).toBeUndefined()
|
||||
expect(repaired.result).toMatchObject({ id: 'pty-2' })
|
||||
expect(repaired.result).toMatchObject({ id: expect.any(String) })
|
||||
}, 10_000)
|
||||
|
||||
it('responds to fs.stat over stdin/stdout', async () => {
|
||||
|
||||
Reference in New Issue
Block a user