52cea07fee
8 карточек-контрактов phase-0: playwright-mcp, github-mcp, markdownlint, cspell, lychee, stylelint, gitleaks, pa11y (все external, zero-hash + path"" → G4 инертен). m3a расширен: «ВСЕ файлы contracts/ form-валидны + нет дрейфа» (loadRegistry errors + driftFlags пусты) — per-батч валидация прогоном vitest. m3a 3/3 GREEN. coverage: skill:executing-plans
26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { readFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { dirname, join } from 'node:path';
|
|
import { validateContract } from './skill-contract.mjs';
|
|
import { loadRegistry } from './skill-contract-registry.mjs';
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
const contractsDir = join(here, '..', 'docs', 'registry', 'contracts');
|
|
|
|
describe('Машина 3-A — инварианты контрактов', () => {
|
|
it('образец own (writing-plans) валиден по форме', () => {
|
|
const c = JSON.parse(readFileSync(join(contractsDir, 'writing-plans.contract.json'), 'utf8'));
|
|
expect(validateContract(c)).toEqual({ ok: true, errors: [] });
|
|
});
|
|
it('образец external (operations:process-doc) валиден по форме', () => {
|
|
const c = JSON.parse(readFileSync(join(contractsDir, 'operations-process-doc.contract.json'), 'utf8'));
|
|
expect(validateContract(c).ok).toBe(true);
|
|
});
|
|
it('ВСЕ файлы contracts/ form-валидны (нет ошибок формы/дублей/дрейфа)', () => {
|
|
const reg = loadRegistry({ dir: contractsDir });
|
|
expect(reg.errors).toEqual([]);
|
|
expect(reg.driftFlags).toEqual([]);
|
|
});
|
|
});
|