test: align automatic report contract with F4 sealing

This commit is contained in:
2026-09-08 09:15:26 -03:00
parent 28ec002710
commit c11808f560
@@ -11,14 +11,15 @@ const controller = read('src/inspection-reports/inspection-reports.controller.ts
const builder = read('src/inspection-reports/inspection-report-word-builder.ts');
const wordService = read('src/inspection-reports/inspection-report-word.service.ts');
test('D5.3.20 freezes one report automatically in the same act-closing transaction', () => {
test('D5.3.20/F4 freezes one report from each sealed act and generates its Word artifact', () => {
assert.match(closing, /await this\.reports\.ensureFrozenReport\(manager, actId, principal, request\)/);
assert.match(closing, /await this\.reports\.ensureWordForAct\(actId\)/);
assert.match(reports, /async ensureFrozenReport\(/);
assert.match(reports, /SELECT id FROM inspection_reports WHERE act_id/);
assert.match(reports, /act\.status = 'SEALED'/);
});
test('D5.3.20 stores an integrity-checked Word artifact without changing the frozen report', () => {
test('D5.3.20 stores an integrity-checked Word artifact without changing the frozen source snapshot', () => {
assert.match(migration, /ADD COLUMN word_status varchar\(24\)/);
assert.match(migration, /word_sha256 char\(64\)/);
assert.match(migration, /word_generated_at timestamptz/);
@@ -35,7 +36,8 @@ test('D5.3.20 builds OOXML Word from the frozen act snapshot without external do
assert.doesNotMatch(builder, /nodemailer|libreoffice|pandoc/i);
});
test('D5.3.20 keeps frozen report generation act-scoped and leaves email delivery for a configured phase', () => {
assert.match(closing, /findingsRemainOpen: true/);
test('F4 keeps report generation act-scoped while findings and inspection lifecycle remain independent', () => {
assert.match(closing, /findingsRemainIndependent: true/);
assert.match(closing, /inspectionRemainsIndependent: true/);
assert.doesNotMatch(migration, /smtp|email_outbox|mail_delivery/i);
});