test(f5): align operational navigation contract

This commit is contained in:
2026-09-08 22:35:05 -03:00
parent ec535233fa
commit a53306b9d7
@@ -7,13 +7,15 @@ async function source(relativePath: string): Promise<string> {
return readFile(resolve(process.cwd(), 'src', relativePath), 'utf8');
}
test('D5.3.11.1 exposes imported operational assignments in Maestro navigation without creating legal relations', async () => {
test('D5.3.11.1/F5 navigates Area ↔ Empresa from temporal operator relations instead of Inventory ownership', async () => {
const service = await source('asset-master/asset-operational-relations.service.ts');
assert.match(service, /SELECT asset\.operator_company_id AS company_id/);
assert.match(service, /WHERE asset\.operational_area_id = \$1/);
assert.match(service, /SELECT asset\.operational_area_id AS area_id/);
assert.match(service, /WHERE asset\.operator_company_id = \$1/);
assert.match(service, /UNION/);
assert.match(service, /FROM area_company_relations relation/);
assert.match(service, /WHERE relation\.area_id = \$1/);
assert.match(service, /WHERE relation\.company_id = \$1/);
assert.match(service, /relation\.relation_role = 'OPERATOR'/);
assert.match(service, /relation\.valid_until IS NULL/);
assert.doesNotMatch(service, /SELECT asset\.operator_company_id AS company_id/);
assert.doesNotMatch(service, /SELECT asset\.operational_area_id AS area_id/);
assert.doesNotMatch(service, /INSERT INTO area_company_relations[\s\S]*listAreasForCompany/);
});