cf813c1091
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
2.8 KiB
JavaScript
34 lines
2.8 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
||
import { buildRouterSurface, buildMentorSurface, buildJudgeSurface } from './verdict-surface-detail.mjs';
|
||
|
||
describe('buildRouterSurface', () => {
|
||
it('рекомендация + круг', () => expect(buildRouterSurface({ recommendedChain: ['billing-audit'], declared: ['tdd'] }, { round: 2 }))
|
||
.toBe('🧭 РОУТЕР [круг 2]: рекомендует [billing-audit] · объявлено [tdd]'));
|
||
it('classify недоступен (null chain)', () => expect(buildRouterSurface({ recommendedChain: null, declared: [] }, { round: 1 }))
|
||
.toBe('🧭 РОУТЕР [круг 1]: скил-сверка пропущена (classify недоступен/сбой)'));
|
||
it('мусор → пусто', () => { expect(buildRouterSurface(null)).toBe(''); expect(buildRouterSurface(42)).toBe(''); });
|
||
});
|
||
|
||
describe('buildMentorSurface', () => {
|
||
it('GO с деталью', () => expect(buildMentorSurface({ kind: 'go' }, { round: 1, verdict: { reasoning: 'связно', recommendation: 'назвать тест' } }))
|
||
.toBe('🧑🏫 НАСТАВНИК [круг 1]: GO · reasoning: связно · recommendation: назвать тест'));
|
||
it('NO-GO с текстом', () => expect(buildMentorSurface({ kind: 'nogo', text: 'переделай D2' }, { round: 3 }))
|
||
.toBe('🧑🏫 НАСТАВНИК [круг 3]: NO-GO · переделай D2'));
|
||
it('degraded', () => expect(buildMentorSurface({ kind: 'degraded', reason: 'нет ключа' }, {}))
|
||
.toBe('🧑🏫 НАСТАВНИК: ⚠ не дозвонился (нет ключа)'));
|
||
it('skip', () => expect(buildMentorSurface({ kind: 'skip', reason: 'не судится' }, {}))
|
||
.toBe('🧑🏫 НАСТАВНИК: ⏭ пропуск (не судится)'));
|
||
it('мусор → пусто', () => { expect(buildMentorSurface(null)).toBe(''); expect(buildMentorSurface({ kind: 'wat' }, {})).toBe(''); });
|
||
});
|
||
|
||
describe('buildJudgeSurface', () => {
|
||
it('GO', () => expect(buildJudgeSurface({ kind: 'go' }, { gate: 'gate1' })).toBe('⚖️ СУДЬЯ gate1: GO'));
|
||
it('NO-GO с текстом', () => expect(buildJudgeSurface({ kind: 'nogo', text: 'completeness пуст' }, { gate: 'gate2' }))
|
||
.toBe('⚖️ СУДЬЯ gate2: NO-GO · completeness пуст'));
|
||
it('degraded', () => expect(buildJudgeSurface({ kind: 'degraded', reason: 'нет ключа судьи' }, { gate: 'gate1' }))
|
||
.toBe('⚖️ СУДЬЯ gate1: ⚠ не дозвонился (нет ключа судьи)'));
|
||
it('skip', () => expect(buildJudgeSurface({ kind: 'skip', reason: 'не судится' }, { gate: 'gate1' }))
|
||
.toBe('⚖️ СУДЬЯ gate1: ⏭ пропуск (не судится)'));
|
||
it('мусор → пусто', () => { expect(buildJudgeSurface(null, {})).toBe(''); expect(buildJudgeSurface({ kind: 'x' }, {})).toBe(''); });
|
||
});
|