import { describe, expect, it } from 'vitest'; import { guideStage, scriptUrl } from './RunGuide'; describe('run guide', () => { const run = (status: string, pending_gate: string | null = null, current_node: string | null = null) => ({ status, pending_gate, current_node }); it('shows exactly one step for every state of a test run', () => { expect(guideStage(run('queued'), 0)).toBe('prepare'); expect(guideStage(run('running', null, 'synthesizer'), 0)).toBe('prepare'); expect(guideStage(run('waiting_approval', 'approve_cases', 'approval_gate'), 79)).toBe('approve'); expect(guideStage(run('running', null, 'executor'), 79)).toBe('testing'); expect(guideStage(run('running', null, 'self_heal'), 79)).toBe('testing'); expect(guideStage(run('waiting_review', 'human_review', 'human_review'), 79)).toBe('judge'); expect(guideStage(run('completed'), 79)).toBe('result'); for (const s of ['failed', 'killed', 'cancelled', 'interrupted']) expect(guideStage(run(s), 79)).toBe('stopped'); }); it('a finished run is a result even if a gate flag is stale', () => { expect(guideStage(run('completed', 'human_review'), 79)).toBe('result'); }); it('links the Excel test script of the run', () => { expect(scriptUrl('20261011-1 2')).toBe('/api/runs/20261011-1%202/test-script.xlsx'); }); });