F4.3 · dossier INF, GEDO IF y seguimiento

This commit is contained in:
2026-09-07 19:55:04 -03:00
parent 367c7df45a
commit fbe8f2e8cf
10 changed files with 915 additions and 6 deletions
@@ -0,0 +1,23 @@
import 'reflect-metadata';
import assert from 'node:assert/strict';
import test from 'node:test';
import { REQUIRED_PERMISSIONS_KEY } from '../../src/authorization/decorators/require-permissions.decorator';
import {
InspectionReportDossierController,
InspectionReportFollowUpFileController,
} from '../../src/inspection-reports/inspection-report-dossier.controller';
function permissions(controller: object, method: string): string[] {
const handler = controller[method as keyof typeof controller];
return Reflect.getMetadata(REQUIRED_PERMISSIONS_KEY, handler) as string[];
}
test('F4 report dossier separates read, edit, GEDO officialization and append-only follow-up', () => {
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'get'), ['inspection_reports.read']);
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'updateContent'), ['inspection_reports.edit']);
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'officializeGedo'), ['inspection_reports.officialize']);
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'gedoPdf'), ['inspection_reports.read']);
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'followUps'), ['inspection_reports.read']);
assert.deepEqual(permissions(InspectionReportDossierController.prototype, 'createFollowUp'), ['inspection_reports.follow_up']);
assert.deepEqual(permissions(InspectionReportFollowUpFileController.prototype, 'content'), ['inspection_reports.read']);
});
@@ -0,0 +1,30 @@
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/);
});