From 6f100bf9bae6c1478133f565255cf981bfcdcdef Mon Sep 17 00:00:00 2001 From: enlineawork Date: Tue, 8 Sep 2026 09:35:57 -0300 Subject: [PATCH] test: align document center baseline with F4 report lifecycle --- .../test/unit/phase-d5-3-15-document-center.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api-v3/test/unit/phase-d5-3-15-document-center.test.ts b/api-v3/test/unit/phase-d5-3-15-document-center.test.ts index 52ab6ed..948a4ac 100644 --- a/api-v3/test/unit/phase-d5-3-15-document-center.test.ts +++ b/api-v3/test/unit/phase-d5-3-15-document-center.test.ts @@ -6,26 +6,30 @@ import { resolve } from 'node:path'; const reportService = readFileSync(resolve(process.cwd(), 'src/inspection-reports/inspection-reports.service.ts'), 'utf8'); const actService = readFileSync(resolve(process.cwd(), 'src/inspection-acts/inspection-acts.service.ts'), 'utf8'); const migration = readFileSync(resolve(process.cwd(), 'src/database/migrations/1788026400000-phase-d5-3-15-document-center.ts'), 'utf8'); +const f4Lifecycle = readFileSync(resolve(process.cwd(), 'src/database/migrations/1790000600000-f4-align-document-lifecycle-constraints.ts'), 'utf8'); -test('D5.3.15 exposes global acts and pending report emission', () => { +test('D5.3.15/F4 exposes global acts and report emission after an Act is SEALED', () => { assert.match(actService, /async listGlobal\(query: ListInspectionActsQueryDto\)/); assert.match(reportService, /async listPending\(query: ListInspectionReportsQueryDto\)/); - assert.match(reportService, /act\.status = 'CLOSED'/); + assert.match(reportService, /act\.status = 'SEALED'/); assert.match(reportService, /report\.id IS NULL/); + assert.match(reportService, /act\.closure_sha256 IS NOT NULL/); }); -test('D5.3.15 freezes a report from the final closed act snapshot', () => { +test('D5.3.15/F4 freezes the immutable sealed Act snapshot as the INF source', () => { assert.match(reportService, /assertMobileInspector\(principal\)/); assert.match(reportService, /final_snapshot AS "finalSnapshot"/); assert.match(reportService, /DocumentSequenceType\.REPORT/); assert.match(reportService, /sha256CanonicalJson\(frozenSnapshot\)/); + assert.match(reportService, /InspectionReportStatus\.WORKING/); assert.match(reportService, /INSPECTION_REPORT_GENERATED/); }); -test('D5.3.15 migration creates independent report numbering and protected frozen content', () => { +test('D5.3.15 frozen source guarantees survive while F4 expands report workflow states', () => { assert.match(migration, /CREATE TABLE inspection_reports/); assert.match(migration, /UNIQUE \(report_year, report_number\)/); assert.match(migration, /dhv2_guard_inspection_report_frozen/); assert.match(migration, /inspection_reports\.read/); assert.match(migration, /inspection_reports\.generate/); + assert.match(f4Lifecycle, /status IN \('WORKING','OFFICIALIZED','FROZEN','CANCELLED'\)/); });