Files
dh-inspeccion-v2/api-v3/test/unit/f6-15-act-map-context.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

67 lines
3.2 KiB
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import test from 'node:test';
function api(path: string) { return readFileSync(resolve(process.cwd(), path), 'utf8'); }
function web(path: string) { return readFileSync(resolve(process.cwd(), `../web-v2/src/${path}`), 'utf8'); }
test('F6.15 Acta exposes full territorial and affected-inventory context', () => {
const acts = api('src/inspection-acts/inspection-acts.service.ts');
const findings = api('src/inspection-findings/inspection-findings.service.ts');
const page = web('pages/InspectionActEditorPage.tsx');
const media = web('features/inspections/InspectionActMediaPanel.tsx');
for (const field of ['department', 'area', 'yacimiento', 'company', 'installations', 'subinstallations']) {
assert.match(acts, new RegExp(`'${field}'`));
}
assert.match(acts, /legacyAreaScope/);
assert.match(findings, /'hierarchy'/);
assert.match(findings, /'installation'/);
assert.match(findings, /'subinstallation'/);
assert.match(page, /Ubicación territorial y operativa/);
assert.match(page, /No definido en la Inspección histórica/);
assert.match(media, /Elemento afectado:/);
assert.match(media, /Constatación:/);
});
test('F6.15 Acta uses real report workflow state instead of legacy generated PDF status', () => {
const acts = api('src/inspection-acts/inspection-acts.service.ts');
const page = web('pages/InspectionActEditorPage.tsx');
const list = web('pages/ActsPage.tsx');
assert.match(acts, /'gedoIfIdentifier'/);
assert.match(acts, /'gedoOfficializedAt'/);
assert.match(acts, /'wordStatus'/);
assert.match(page, /act\.report\.status === 'OFFICIALIZED'/);
assert.match(page, /Oficializado en GEDO/);
assert.doesNotMatch(page, /act\.report\.pdfStatus === 'READY'/);
assert.match(list, /act\.report\.status === 'OFFICIALIZED'/);
});
test('F6.16 map renders operational locations as GPS point markers without filters', () => {
const controller = api('src/asset-master/asset-geometries.controller.ts');
const service = api('src/asset-master/asset-geometries.service.ts');
const page = web('pages/MapPage.tsx');
const map = web('features/map/DhMap.tsx');
assert.match(controller, /@Controller\('map\/context'\)/);
assert.match(controller, /@Controller\('map\/documents'\)/);
assert.match(service, /WITH RECURSIVE y_tree/);
assert.match(service, /ST_Centroid\(ST_Collect\(geometry\.geometry\)\)/);
assert.match(service, /COALESCE\(finding\.target_geometry,finding\.fallback_geometry\)/);
for (const kind of ['YACIMIENTO', 'COMPANY', 'ACT', 'FINDING']) {
assert.match(service, new RegExp(`'${kind}'::text`));
assert.match(page, new RegExp(`${kind}:`));
}
assert.match(page, /punto\{data\.meta\.count === 1 \? '' : 's'\} GPS/);
assert.match(page, /feature\.geometry\.type\.toLowerCase\(\) === 'point'/);
assert.match(page, /map-legend/);
assert.doesNotMatch(page, /SearchableSelect/);
assert.doesNotMatch(page, /mapSearch/);
assert.doesNotMatch(page, /toggleLayer/);
assert.match(map, /new Marker/);
assert.match(map, /pointCoordinates/);
assert.match(map, /visualOffsets/);
assert.match(map, /fitToPoints/);
assert.doesNotMatch(map, /addSource\('assets'/);
assert.doesNotMatch(map, /addLayer\(/);
});