2026-06-15 08:06:08 +03:00
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
|
import { dirname, join } from 'node:path';
|
|
|
|
|
import { buildRegistry } from './skill-contract-registry.mjs';
|
|
|
|
|
import { readinessChecklist, findHoles } from './coverage-machine.mjs';
|
|
|
|
|
|
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
|
|
|
const cdir = join(here, '..', 'docs', 'registry', 'contracts');
|
|
|
|
|
|
|
|
|
|
describe('Машина 3-C — охват на реальных контрактах 3-A', () => {
|
|
|
|
|
it('контракты 3-A загружаются и прогоняются через машину охвата', () => {
|
2026-06-18 22:53:20 +03:00
|
|
|
// writing-plans мигрирован в superpowers__writing-plans (external) при разворачивании superpowers
|
|
|
|
|
const wp = JSON.parse(readFileSync(join(cdir, 'superpowers__writing-plans.contract.json'), 'utf8'));
|
2026-06-15 08:06:08 +03:00
|
|
|
const pd = JSON.parse(readFileSync(join(cdir, 'operations-process-doc.contract.json'), 'utf8'));
|
2026-06-18 22:53:20 +03:00
|
|
|
const { contracts } = buildRegistry([{ contract: wp, currentContent: '' }, { contract: pd, currentContent: '' }]);
|
|
|
|
|
const r = readinessChecklist({ contracts, requests: ['план реализации из bite-sized TDD-задач без плейсхолдеров'] });
|
2026-06-15 08:06:08 +03:00
|
|
|
expect(Array.isArray(r.items)).toBe(true);
|
|
|
|
|
expect(r.items).toHaveLength(4);
|
|
|
|
|
expect(r.items.find((i) => /просьб/i.test(i.label)).ok).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
it('findHoles на контракте с непокрытой нуждой ловит дыру', () => {
|
2026-06-18 22:53:20 +03:00
|
|
|
const wp = JSON.parse(readFileSync(join(cdir, 'superpowers__writing-plans.contract.json'), 'utf8'));
|
2026-06-15 08:06:08 +03:00
|
|
|
const holes = findHoles([wp]);
|
|
|
|
|
expect(holes.length).toBeGreaterThan(0);
|
|
|
|
|
});
|
|
|
|
|
});
|