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 institutional numbering keeps Inspection, Act and INF date-readable and coherent', () => { const migration = read('src/database/migrations/1790046000000-phase-f4-document-numbering.ts'); assert.match(migration, /INSP-/); assert.match(migration, /ACT-/); assert.match(migration, /INF-/); assert.match(migration, /DD-MM-YY/); assert.match(migration, /LPAD\(act_number::text, 5, '0'\)/); }); test('F4 gives one INF the same annual correlativo as its one Act', () => { const migration = read('src/database/migrations/1790046000000-phase-f4-document-numbering.ts'); assert.match(migration, /report_number = act\.act_number/); assert.match(migration, /NEW\.report_number := source_act\.act_number/); assert.match(migration, /NEW\.report_year := source_act\.act_year/); assert.match(migration, /trg_dhv2_f4_set_report_code/); });