Files
dh-inspeccion-v2/api-v3/test/unit/asset-navigation-d5-3-10-2.test.ts
T

31 lines
1.2 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.10.2 exposes a read-only lineage endpoint for Maestro breadcrumbs', async () => {
const controller = await source('asset-master/assets.controller.ts');
const service = await source('asset-master/assets.service.ts');
assert.match(controller, /@Get\(':id\/lineage'\)/);
assert.match(controller, /@RequirePermissions\('assets\.read'\)/);
assert.match(service, /async lineage\(id: string\)/);
assert.match(service, /WITH RECURSIVE lineage AS/);
assert.match(service, /ORDER BY lineage\.depth DESC/);
});
test('production API source keeps external-review hygiene', async () => {
const files = [
'main.ts',
'asset-imports/asset-import-plan.ts',
'inspection-operations/mobile-inspector-policy.ts',
'asset-master/asset-master-bootstrap.ts',
];
const content = (await Promise.all(files.map(source))).join('\n');
assert.doesNotMatch(content, /^\s*(?:\/\/|\/\*|\*)/m);
});