32 lines
1.4 KiB
TypeScript
32 lines
1.4 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import { resolve } from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
async function source(relativePath: string): Promise<string> {
|
|
return readFile(resolve(process.cwd(), 'src', relativePath), 'utf8');
|
|
}
|
|
|
|
test('D5.3.4 adds a bounded hierarchy query without changing physical parent semantics', async () => {
|
|
const controller = await source('asset-master/assets.controller.ts');
|
|
const service = await source('asset-master/assets.service.ts');
|
|
const dto = await source('asset-master/dto/list-asset-tree-query.dto.ts');
|
|
|
|
assert.match(controller, /@Get\('tree'\)/);
|
|
assert.match(controller, /@RequirePermissions\('assets\.read'\)/);
|
|
assert.match(service, /WITH RECURSIVE matched AS/);
|
|
assert.match(service, /JOIN visible current/);
|
|
assert.match(service, /rows\.length > 5000/);
|
|
assert.match(service, /asset_external_identifiers external_id/);
|
|
assert.match(dto, /needsValidation\?: boolean/);
|
|
assert.match(dto, /hasGeometry\?: boolean/);
|
|
});
|
|
|
|
test('D5.3.4 exposes operational dashboard counts before technical administration metrics', async () => {
|
|
const dashboard = await source('dashboard/dashboard.service.ts');
|
|
assert.match(dashboard, /"plannedInspections"/);
|
|
assert.match(dashboard, /"assetsNeedValidation"/);
|
|
assert.match(dashboard, /"assetsWithoutGeometry"/);
|
|
assert.match(dashboard, /information_status NOT IN \('VALIDATED','INACTIVE'\)/);
|
|
});
|