Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.1 KB
Raw Blame
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')
    }
  )
})