37 lines
1.9 KiB
TypeScript
37 lines
1.9 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 foundation snapshots Act deadlines and seeds the institutional 5/10 business-day policy', () => {
|
|
const migration = read('src/database/migrations/1790035200000-phase-f4-document-flow-foundation.ts');
|
|
assert.match(migration, /deadline_policy_snapshot jsonb/);
|
|
assert.match(migration, /'URGENT', 5, 'BUSINESS', 'ACT_DATE'/);
|
|
assert.match(migration, /'NON_URGENT', 10, 'BUSINESS', 'GEDO_LOAD_DATE'/);
|
|
assert.match(migration, /inspection_non_working_days/);
|
|
});
|
|
|
|
test('F4 foundation models recurrence as a new Finding linked to its antecedent', () => {
|
|
const finding = read('src/database/entities/inspection-finding.entity.ts');
|
|
const migration = read('src/database/migrations/1790035200000-phase-f4-document-flow-foundation.ts');
|
|
assert.match(finding, /isRecurrence!/);
|
|
assert.match(finding, /antecedentFindingId!/);
|
|
assert.match(migration, /fk_inspection_findings_antecedent/);
|
|
assert.match(migration, /chk_inspection_findings_recurrence_link/);
|
|
});
|
|
|
|
test('F4 foundation separates editable INF content, GEDO IF officialization and report-level follow-up', () => {
|
|
const report = read('src/database/entities/inspection-report.entity.ts');
|
|
const migration = read('src/database/migrations/1790035200000-phase-f4-document-flow-foundation.ts');
|
|
assert.match(report, /executiveSummary!/);
|
|
assert.match(report, /description!/);
|
|
assert.match(report, /gedoIfIdentifier!/);
|
|
assert.match(report, /gedoOfficializedOn!/);
|
|
assert.match(migration, /inspection_report_follow_ups/);
|
|
assert.match(migration, /COMPANY_NOTE/);
|
|
assert.doesNotMatch(migration, /finding_id uuid NOT NULL[\s\S]*inspection_report_follow_ups/);
|
|
});
|