F4.8 · pruebas de cierre de Inspección
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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 forbids closing an Inspection while any Act still awaits company outcome', () => {
|
||||
const service = read('src/inspection-visits/inspection-visit-closure.service.ts');
|
||||
assert.match(service, /INSPECTION_VISIT_COMPANY_OUTCOME_PENDING/);
|
||||
assert.match(service, /signature\.status IN \('SIGNED', 'REFUSED', 'ABSENT'\)/);
|
||||
assert.match(service, /recipient|signature|empresa/i);
|
||||
});
|
||||
|
||||
test('F4 requires all non-cancelled Acts to be sealed before closing the Inspection', () => {
|
||||
const service = read('src/inspection-visits/inspection-visit-closure.service.ts');
|
||||
assert.match(service, /INSPECTION_VISIT_ACTS_NOT_SEALED/);
|
||||
assert.match(service, /act\.closure_sha256 IS NULL/);
|
||||
assert.match(service, /allActsSealed: true/);
|
||||
});
|
||||
|
||||
test('F4 stamps sealed_at when an Act reaches the physical CLOSED state', () => {
|
||||
const migration = read('src/database/migrations/1790056800000-phase-f4-sealed-acts.ts');
|
||||
assert.match(migration, /sealed_at/);
|
||||
assert.match(migration, /dhv2_f4_stamp_act_seal/);
|
||||
assert.match(migration, /NEW\.status = 'CLOSED'/);
|
||||
});
|
||||
Reference in New Issue
Block a user