test: align document center baseline with F4 report lifecycle
This commit is contained in:
@@ -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'\)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user