diff --git a/api-v3/test/unit/f6-1-inspection-planning-hierarchy.test.ts b/api-v3/test/unit/f6-1-inspection-planning-hierarchy.test.ts index 8431720..01d7881 100644 --- a/api-v3/test/unit/f6-1-inspection-planning-hierarchy.test.ts +++ b/api-v3/test/unit/f6-1-inspection-planning-hierarchy.test.ts @@ -26,7 +26,7 @@ test('F6.1 inspection planning exposes Departamento → Área → Yacimiento exp assert.doesNotMatch(createPage, /Área \/ Yacimiento/); }); -test('F6.1 WEB creation freezes Area and uses the selected Yacimiento as physical scope', () => { +test('Authoritative WEB creation freezes Area and validates Company against selected Yacimiento', () => { const dto = source('src/inspection-visits/dto/create-inspection-visit.dto.ts'); const scope = source('src/inspection-visits/inspection-planning-scope.ts'); const create = source('src/inspection-visits/inspection-planning-create.service.ts'); @@ -37,15 +37,18 @@ test('F6.1 WEB creation freezes Area and uses the selected Yacimiento as physica assert.match(scope, /lower\(type\.code\)='yacimiento'/); assert.match(create, /scopeAssetId,/); assert.match(create, /operationalAreaId: dto\.operationalAreaId/); - assert.match(create, /relation\.relation_role='OPERATOR'/); - assert.match(create, /relation\.valid_from <= \$3::timestamptz/); + assert.match(create, /yacimiento\.operator_company_id=\$3::uuid/); + assert.match(create, /yacimiento\.concession_type_id IS NOT NULL/); + assert.match(create, /INSPECTION_OPERATOR_NOT_RELATED_TO_YACIMIENTO/); assert.match(createPage, /scopeAssetId: yacimientoId/); }); -test('F6.1 WEB inspection creation does not use Inventory operator snapshots', () => { +test('Authoritative WEB inspection creation uses Yacimiento context and not descendant Inventory snapshots', () => { const create = source('src/inspection-visits/inspection-planning-create.service.ts'); - assert.match(create, /area_company_relations relation/); + assert.match(create, /yacimiento\.operator_company_id/); + assert.match(create, /operatorSource: 'YACIMIENTO'/); + assert.doesNotMatch(create, /area_company_relations relation/); assert.doesNotMatch(create, /inventory\.operator_company_id/); assert.doesNotMatch(create, /asset\.operator_company_id/); });