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 06a008e..9c36c80 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,6 +32,17 @@ test('F5.1 canonical hierarchy starts at Departamento and Area is no longer root assert.match(migration, /SET can_be_root=false/); }); +test('F5.1 manual creation permits Area context without requiring an operator', () => { + const migration = source('src/database/migrations/1790087400000-f5-1-clean-manual-inventory.ts'); + const structure = source('src/asset-master/inventory-structure.service.ts'); + + assert.match(migration, /DROP CONSTRAINT IF EXISTS chk_asset_context_history_context_pair/); + assert.match(migration, /CHECK \(operator_company_id IS NULL OR operational_area_id IS NOT NULL\)/); + assert.match(structure, /operator_company_id,inventory_family_id/); + assert.match(structure, /asset_context_history/); + assert.match(structure, /operational_area_id,operator_company_id/); +}); + test('F5.1 Inventory browser exposes every canonical level instead of filtering by is_inventory_instance', () => { const browser = source('src/asset-master/inventory-browser.service.ts'); const controller = source('src/asset-master/inventory-browser.controller.ts'); @@ -48,10 +59,22 @@ test('F5.1 Finding Catalog defaults to associated findings and exposes all items assert.match(panel, /type ViewMode = 'ASSOCIATED' \| 'ALL'/); assert.match(panel, /useState\('ASSOCIATED'\)/); assert.match(panel, /available\.filter\(\(item\) => savedIds\.has\(item\.id\)\)/); + assert.match(panel, /Buscar dentro de \{viewMode === 'ASSOCIATED' \? 'los asociados' : 'todo el Catálogo'\}/); assert.match(panel, /Todos para vincular/); assert.match(panel, /Esta clasificación todavía no tiene Hallazgos asociados/); }); +test('F5.1 Configuration manages findings inline and filters Subinstallations by Installation', () => { + const configPage = source('../web-v2/src/pages/AssetTypesPage.tsx'); + + assert.match(configPage, /replaceInventoryFamilyFindings/); + assert.match(configPage, /Agregar o quitar/); + assert.match(configPage, /familyFindingIds/); + assert.match(configPage, /selectedInstallationFamilyId/); + assert.match(configPage, /family\.parentFamilyId === selectedInstallationFamilyId/); + assert.match(configPage, /Filtrar por tipo de Instalación/); +}); + test('F5.1 Web creation and configuration expose Departamento as the physical root', () => { const createPage = source('../web-v2/src/pages/InventoryCreatePage.tsx'); const configPage = source('../web-v2/src/pages/AssetTypesPage.tsx');