Files
dh-inspeccion-v2/api-v3/test/unit/phase-f4-act-lock.test.ts
T

31 lines
1.3 KiB
TypeScript

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
const root = process.cwd();
const read = (relative: string) => fs.readFileSync(path.join(root, relative), 'utf8');
test('F4 locks an Act without requiring an artificial Finding', () => {
const service = read('src/inspection-closing/inspection-act-lifecycle.service.ts');
assert.doesNotMatch(service, /INSPECTION_ACT_FINDING_REQUIRED/);
assert.doesNotMatch(service, /COUNT\(\*\).*inspection_findings[\s\S]*< 1/);
assert.match(service, /requireVerificationResults/);
});
test('F4 freezes urgency and the exact deadline policy at lock time', () => {
const service = read('src/inspection-closing/inspection-act-lifecycle.service.ts');
assert.match(service, /snapshotForLock/);
assert.match(service, /deadline_policy_snapshot/);
assert.match(service, /locked_sha256/);
assert.match(service, /LOCKED_PENDING_SIGNATURE/);
});
test('F4 removes the reopen route once an Act has been blocked', () => {
const controller = read('src/inspection-closing/inspection-closing.controller.ts');
assert.doesNotMatch(controller, /@Post\('reopen'\)/);
assert.doesNotMatch(controller, /@Post\('ready'\)/);
const lifecycle = read('src/inspection-closing/inspection-act-lifecycle.controller.ts');
assert.match(lifecycle, /@Post\('lock'\)/);
});