28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { runDetailSchema } from '../../../src/schemas/runs'
|
|
|
|
const run = {
|
|
run_id: 1,
|
|
status: 'running',
|
|
terminal: false,
|
|
phase: 'executing',
|
|
selected_count: 10,
|
|
processed_count: 5,
|
|
completed_count: 4,
|
|
error_count: 1,
|
|
progress_percent: 50,
|
|
current_execution_id: 'R0006',
|
|
started_at: '2026-07-17T00:00:00Z',
|
|
finished_at: null,
|
|
error_message: null,
|
|
poll_after_seconds: 2,
|
|
summary: {},
|
|
}
|
|
|
|
describe('runDetailSchema', () => {
|
|
it('accepts a consistent running task', () => expect(runDetailSchema.safeParse(run).success).toBe(true))
|
|
it('rejects inconsistent counters', () => expect(runDetailSchema.safeParse({ ...run, processed_count: 7 }).success).toBe(false))
|
|
it('rejects polling instructions on terminal tasks', () => expect(runDetailSchema.safeParse({ ...run, status: 'completed', terminal: true }).success).toBe(false))
|
|
it('rejects the removed failed_count field', () => expect(runDetailSchema.safeParse({ ...run, error_count: undefined, failed_count: 1 }).success).toBe(false))
|
|
})
|