Files
brain/tools/gate-arbitration-wiring.test.mjs
T

29 lines
1.6 KiB
JavaScript

import { describe, it, expect } from 'vitest';
import { buildJudgeArbitrationMessage } from './enforce-judge-gate.mjs';
describe('buildJudgeArbitrationMessage (wave 6 — judge escalation → card)', () => {
it('включает дословное замечание судьи + позицию контроллера + 3 выбора + L2', () => {
const msg = buildJudgeArbitrationMessage(
{ objections: [{ anchor: { ref: 'шаг 3 не проверяем' }, severity: 'heavy' }] },
'## Переговоры\n### Круг 3\nНе согласен: критерий проверяемый — pest зелёный.',
3,
);
expect(msg).toContain('шаг 3 не проверяем');
expect(msg).toContain('критерий проверяемый — pest зелёный');
expect(msg).toMatch(/держусь/i);
expect(msg).toMatch(/согласиться/i);
expect(msg).toMatch(/своё/i);
expect(msg).toMatch(/L2/);
});
it('нет позиции в плане → плейсхолдер, не падает', () => {
const msg = buildJudgeArbitrationMessage({ objections: [{ anchor: { ref: 'X' } }] }, '# План\n', 3);
expect(msg).toContain('X');
expect(typeof msg).toBe('string');
});
it('судья без текста возражения → плейсхолдер', () => {
const msg = buildJudgeArbitrationMessage({ objections: [] }, '## Переговоры\n### Круг 3\nмоя позиция', 3);
expect(msg).toContain('моя позиция');
expect(typeof msg).toBe('string');
});
});