Files
dh-inspeccion-v2/api-v3/test/unit/f6-12-map-smtp-admin-fixes.test.ts
T
ChatGPT DH fa6ba7f31e
DH V2 CI / API · typecheck, tests, build (push) Successful in 40s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 9s
DH V2 CI / WEB · typecheck, build (push) Successful in 1m38s
DH V2 CI / Docker / migrations / production images (push) Successful in 1m55s
DH V2 CI / Promote verified main to deploy (push) Successful in 4s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 4m24s
fix(web): render operational map as GPS points
2026-09-16 08:55:54 -03:00

33 lines
1.5 KiB
TypeScript

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/);
});