Files
dh-inspeccion-v2/api-v3/test/unit/inspection-closing-integrity.test.ts

21 lines
821 B
TypeScript

import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import test from 'node:test';
test('D5 migration protects signatures, frozen findings and sealed acts', async () => {
const source = await readFile(
resolve(
process.cwd(),
'src/database/migrations/1787328000000-phase-d5-act-closing-signatures.ts',
),
'utf8',
);
assert.match(source, /REVOKE UPDATE ON TABLE inspection_act_signatures/);
assert.match(source, /trg_inspection_acts_closed_immutable/);
assert.match(source, /trg_inspection_findings_frozen_fields/);
assert.match(source, /trg_inspection_evidence_observation_draft/);
assert.match(source, /uq_inspection_act_company_outcome/);
assert.match(source, /closure_sha256 ~ '\^\[0-9a-f\]\{64\}\$'/);
});