From 02091e14e67894bbc31c19e4c1d85aeaeb49a7c5 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Fri, 11 Sep 2026 21:23:47 -0300 Subject: [PATCH] test(inventory): align F5 source guards with F7 simple UX --- ...-1-clean-manual-inventory-contract.test.ts | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/api-v3/test/unit/f5-1-clean-manual-inventory-contract.test.ts b/api-v3/test/unit/f5-1-clean-manual-inventory-contract.test.ts index c7aeac7..49cc0b3 100644 --- a/api-v3/test/unit/f5-1-clean-manual-inventory-contract.test.ts +++ b/api-v3/test/unit/f5-1-clean-manual-inventory-contract.test.ts @@ -32,7 +32,7 @@ test('F5.1 canonical hierarchy starts at Departamento and Area is no longer root assert.match(migration, /SET can_be_root=false/); }); -test('Authoritative manual creation keeps Area physical and stores Company plus concession on Yacimiento', () => { +test('Historical authoritative endpoint keeps the former Yacimiento Company plus concession contract for compatibility', () => { const structure = source('src/asset-master/inventory-structure.service.ts'); const dto = source('src/asset-master/dto/create-inventory-structure.dto.ts'); @@ -66,27 +66,35 @@ test('F5.1 Finding Catalog defaults to associated findings and exposes all items assert.match(panel, /Esta clasificación todavía no tiene Hallazgos asociados/); }); -test('Authoritative Configuration presents exact physical relationships and technical families', () => { +test('F7 Inventory Configuration exposes only simple types, containment and fields', () => { const configPage = source('../web-v2/src/pages/AuthoritativeInventoryConfigPage.tsx'); - assert.match(configPage, /El Área sólo tiene Nombre y pertenece obligatoriamente a un Departamento/); - assert.match(configPage, /Tipo de concesión/); - assert.match(configPage, /Empresa relacionada/); - assert.match(configPage, /Yacimiento → Instalación/); - assert.match(configPage, /Instalación → Subinstalación/); - assert.match(configPage, /installationFamilies\.map/); - assert.match(configPage, /subinstallationFamilies\.map/); - assert.match(configPage, /Hallazgos asociados/); + assert.match(configPage, /Tipos y campos/); + assert.match(configPage, /Departamento → Área → Yacimiento → Instalación → Subinstalación/); + assert.match(configPage, /Un Área puede estar vinculada a varias Empresas/); + assert.match(configPage, /Cada Yacimiento elige una sola Empresa operadora/); + assert.match(configPage, /Tipos de Instalación/); + assert.match(configPage, /Tipos de Subinstalación/); + assert.match(configPage, /Puede estar dentro de/); + assert.match(configPage, /\{ value: 'TEXT', label: 'Texto' \}/); + assert.match(configPage, /\{ value: 'NUMBER', label: 'Número' \}/); + assert.match(configPage, /\{ value: 'DATE', label: 'Fecha' \}/); + assert.match(configPage, /\{ value: 'BOOLEAN', label: 'Sí \/ No' \}/); + assert.doesNotMatch(configPage, /Hallazgos asociados/); }); -test('Authoritative Web creation exposes Departamento as root and Yacimiento as operational owner', () => { +test('F7 Web creation keeps the fixed hierarchy and asks only the required simple context', () => { const createPage = source('../web-v2/src/pages/InventoryCreatePage.tsx'); const configPage = source('../web-v2/src/pages/AuthoritativeInventoryConfigPage.tsx'); + assert.match(createPage, /kind: 'DEPARTAMENTO'/); - assert.match(createPage, /AREA:'Departamento'/); - assert.match(createPage, /Empresa relacionada/); - assert.match(createPage, /Tipo de concesión/); - assert.match(createPage, /Datos opcionales/); - assert.match(configPage, /Departamento<\/strong>/); - assert.match(configPage, /Yacimiento<\/strong>/); + assert.match(createPage, /AREA: 'Departamento'/); + assert.match(createPage, /YACIMIENTO: 'Área'/); + assert.match(createPage, /INSTALACION: 'Yacimiento'/); + assert.match(createPage, /SUBINSTALACION: 'Instalación'/); + assert.match(createPage, /listCompaniesForInventoryArea/); + assert.match(createPage, /Empresa operadora/); + assert.match(createPage, /ALTA RÁPIDA/); + assert.doesNotMatch(createPage, /Tipo de concesión/); + assert.match(configPage, /Departamento → Área → Yacimiento → Instalación → Subinstalación/); });