Files
orca/mobile/src/session/github-pr-check-reply-schema.test.ts
T
Jinjing 0d4eb242d7 Recover failed-job log retrieval onto main (#29180)
* feat(checks): add optional job log outcome

* fix(checks): preserve host capture lifetimes and safe outcomes

* fix(checks): retrieve and retry bounded failed-job logs

* test(checks): cover queued snapshots and captured error safety

* test(checks): verify sanitized host excerpts and paired failures

* test(checks): identify measurements and preserve paired cleanup

* Use the generated check-log fixture in host retrieval tests

* Keep real paired-server shutdown outside the injected stall deadline
2026-10-15 10:36:21 -07:00

33 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { githubPrCheckDetailsSchema } from './github-pr-check-reply-schema'
describe('optional job log outcome', () => {
it.each(['available', 'empty', 'error', 'not_requested'])(
'preserves %s and job metadata',
(logState) => {
const result = githubPrCheckDetailsSchema.parse({
name: 'check',
jobs: [{ id: 1, name: 'job', logTail: 'excerpt', logState, steps: [{ name: 'step' }] }]
})
expect(result?.jobs[0]).toMatchObject({
id: 1,
name: 'job',
logTail: 'excerpt',
logState,
steps: [{ name: 'step' }]
})
}
)
it.each([undefined, null, 'future', 3, {}, ['error']])(
'salvages unknown outcome %j without losing the job',
(logState) => {
const result = githubPrCheckDetailsSchema.parse({
name: 'check',
jobs: [{ id: 1, name: 'job', logTail: 'excerpt', logState }]
})
expect(result?.jobs[0]).toMatchObject({ id: 1, name: 'job', logTail: 'excerpt' })
expect(result?.jobs[0]).not.toHaveProperty('logState')
}
)
})