diff --git a/api-v3/test/unit/asset-navigation-d5-3-11-1.test.ts b/api-v3/test/unit/asset-navigation-d5-3-11-1.test.ts index 51fcb93..a2ed68d 100644 --- a/api-v3/test/unit/asset-navigation-d5-3-11-1.test.ts +++ b/api-v3/test/unit/asset-navigation-d5-3-11-1.test.ts @@ -7,13 +7,15 @@ async function source(relativePath: string): Promise { 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/); });