Files
dh-inspeccion-v2/api-v3/test/unit/inspection-findings-office-workflow.test.ts
T

23 lines
1.1 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
const source = readFileSync(resolve(process.cwd(), 'src/inspection-findings/inspection-findings.service.ts'), 'utf8');
const controller = readFileSync(resolve(process.cwd(), 'src/inspection-findings/inspection-findings.controller.ts'), 'utf8');
test('D5.3.13 separates company response due dates from verification due dates', () => {
assert.match(source, /correction_due_on IS NOT NULL AND correction_due_on/);
assert.match(source, /company_response_received_on IS NOT NULL AND next_control_on/);
assert.match(source, /companyOverdue/);
assert.match(source, /verificationOverdue/);
});
test('D5.3.13/F4 exposes the global worklist and controlled finding closure', () => {
assert.match(controller, /@Get\(\)/);
assert.match(controller, /this\.worklist\.list\(query\)/);
assert.match(controller, /@Patch\(':id\/close'\)/);
assert.match(source, /finding\.status = InspectionFindingStatus\.CLOSED/);
assert.match(source, /finding\.closureNotes = dto\.closureNotes/);
});