import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; import test from 'node:test'; const api = (path: string) => readFileSync(resolve(process.cwd(), path), 'utf8'); const web = (path: string) => readFileSync(resolve(process.cwd(), '..', 'web-v2', path), 'utf8'); test('F6.12 uses standard GeoJSON names in WEB and converts only at the API boundary', () => { const client = web('src/lib/api.ts'); const map = web('src/features/map/DhMap.tsx'); const editor = web('src/features/map/AssetGeometryEditor.tsx'); assert.match(client, /type: 'Point'/); assert.match(client, /type: 'LineString'/); assert.match(client, /type: 'Polygon'/); assert.match(client, /geometryPayload/); assert.match(map, /geometry\.type\.toLowerCase\(\) !== 'point'/); assert.match(editor, /setType\(value\.geometryType\)/); }); test('F6.12 reports missing SMTP encryption configuration explicitly', () => { const smtp = api('src/inspection-reports/smtp-delivery.service.ts'); assert.match(smtp, /SMTP_SETTINGS_MASTER_KEY_NOT_CONFIGURED/); assert.match(smtp, /ServiceUnavailableException/); }); test('F6.12 grants report management to the system administrator role', () => { const migration = api('src/database/migrations/1790142600000-f6-12-admin-report-permission.ts'); assert.match(migration, /role\.code='admin'/); assert.match(migration, /inspection_reports\.generate/); assert.match(migration, /ON CONFLICT\(role_id, permission_id\) DO NOTHING/); });