Files
dh-inspeccion-v2/api-v3/test/unit/phase-f4-report-dossier.test.ts
T

31 lines
1.5 KiB
TypeScript

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 keeps company responses at INF level and never asks for a Finding selector', () => {
const dto = read('src/inspection-reports/dto/create-inspection-report-follow-up.dto.ts');
const service = read('src/inspection-reports/inspection-report-dossier.service.ts');
assert.doesNotMatch(dto, /findingId|findingIds/);
assert.match(service, /InspectionReportFollowUpType\.COMPANY_NOTE/);
assert.doesNotMatch(service, /inspection_findings.*follow_up_id/);
});
test('F4 treats GEDO IF as the legal officialization of the existing INF and starts non-urgent deadline there', () => {
const service = read('src/inspection-reports/inspection-report-dossier.service.ts');
assert.match(service, /gedo_if_identifier/);
assert.match(service, /gedo_officialized_on/);
assert.match(service, /applyGedoOfficialization/);
assert.match(service, /INSPECTION_REPORT_ALREADY_OFFICIALIZED/);
});
test('F4 removes the active Director review controller from the report module', () => {
const moduleSource = read('src/inspection-reports/inspection-reports.module.ts');
assert.doesNotMatch(moduleSource, /InspectionReportReviewController/);
assert.doesNotMatch(moduleSource, /InspectionReportReviewService/);
assert.match(moduleSource, /InspectionReportDossierController/);
});