From a6e71fa29986d7255573ca2ceb2634982df4fa60 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Fri, 11 Sep 2026 21:24:04 -0300 Subject: [PATCH] test(inventory): move Yacimiento creation contract to F7 Area companies --- ...-1-operational-context-consistency.test.ts | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/api-v3/test/unit/f6-1-operational-context-consistency.test.ts b/api-v3/test/unit/f6-1-operational-context-consistency.test.ts index 2dff3fc..290adfa 100644 --- a/api-v3/test/unit/f6-1-operational-context-consistency.test.ts +++ b/api-v3/test/unit/f6-1-operational-context-consistency.test.ts @@ -88,14 +88,21 @@ test('F6.1 WEB Inventory searches use physical scope and never the operator snap } }); -test('WEB creation captures Company and concession only while creating a Yacimiento', () => { +test('F7 WEB creation selects one Area-linked Company for Yacimiento and retires concession from the simple flow', () => { const page = source('../web-v2/src/pages/InventoryCreatePage.tsx'); - const structure = source('src/asset-master/inventory-structure.service.ts'); + const api = source('../web-v2/src/lib/inventoryStructureApi.ts'); + const simpleStructure = source('src/asset-master/simple-inventory-structure.service.ts'); + const migration = source('src/database/migrations/1790110200000-f7-simple-inventory-context.ts'); - assert.match(page, /requiresYacimientoContext = kind === 'YACIMIENTO'/); - assert.match(page, /Empresa relacionada/); - assert.match(page, /Tipo de concesión/); - assert.match(page, /operatorCompanyId:operatorCompanyId \|\| null/); - assert.match(page, /concessionTypeId:concessionTypeId \|\| null/); - assert.match(structure, /Empresa, Departamento, Área y Yacimiento no llevan clasificación técnica/); + assert.match(page, /const requiresCompany = kind === 'YACIMIENTO'/); + assert.match(page, /listCompaniesForInventoryArea\(parentId\)/); + assert.match(page, /Empresa operadora/); + assert.match(page, /operatorCompanyId: operatorCompanyId \|\| null/); + assert.doesNotMatch(page, /Tipo de concesión/); + assert.doesNotMatch(page, /concessionTypeId/); + assert.match(api, /inventory-structure\/simple/); + assert.match(simpleStructure, /requireAreaCompanyRelation/); + assert.match(simpleStructure, /INVENTORY_YACIMIENTO_COMPANY_NOT_IN_AREA/); + assert.match(migration, /La Empresa del Yacimiento debe estar vinculada como explotadora del Área/); + assert.match(migration, /NEW\.operational_area_id:=NEW\.parent_id/); });