F4.3 · dossier INF, GEDO IF y seguimiento
This commit is contained in:
@@ -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']);
|
||||
});
|
||||
Reference in New Issue
Block a user