diff --git a/api-v3/test/unit/f6-solid-inventory-contract.test.ts b/api-v3/test/unit/f6-solid-inventory-contract.test.ts index 8888132..6cf483e 100644 --- a/api-v3/test/unit/f6-solid-inventory-contract.test.ts +++ b/api-v3/test/unit/f6-solid-inventory-contract.test.ts @@ -59,11 +59,12 @@ test('F6 field findings resolve by exact technical classification and keep OTROS assert.match(resolver, /label: 'OTROS'/); }); -test('F6 mobile finding gate uses Area ancestry and temporal operator relation instead of copying company ownership onto each object', () => { +test('F6.1 mobile finding gate uses Yacimiento scope and temporal Area operator relation instead of Inventory company ownership', () => { const fieldFindings = source('src/inspection-visits/field-findings.service.ts'); assert.match(fieldFindings, /WITH RECURSIVE ancestors/); - assert.match(fieldFindings, /WHERE id=visit\.operational_area_id/); + assert.match(fieldFindings, /COALESCE\(visit\.scope_asset_id, visit\.operational_area_id\)/); + assert.match(fieldFindings, /AS "insideScope"/); assert.match(fieldFindings, /FROM area_company_relations relation/); assert.match(fieldFindings, /relation\.relation_role='OPERATOR'/); assert.doesNotMatch(fieldFindings, /asset\.operator_company_id=visit\.operator_company_id/); @@ -79,12 +80,15 @@ test('F6 field-created technical Inventory may be provisional only until the sel assert.match(fieldFindings, /FIELD_FINDING_FAMILY_REQUIRED/); }); -test('F6 Android keeps search and reloads scoped to the current physical parent', () => { +test('F6.1 Android roots search and reload at the Inspection Yacimiento with legacy Area fallback', () => { + const model = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/data/DhMobile.kt'); const viewModel = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt'); const screen = source('../android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/F3VisitRoot.kt'); + assert.match(model, /data class VisitDetail[\s\S]*val scopeAsset: AssetSummary\? = null/); assert.match(viewModel, /var inventoryParentId: String\? by mutableStateOf\(null\)/); - assert.match(viewModel, /effectiveParentId = parentId \?: inventoryParentId \?: currentVisit\.operationalArea\?\.id/); + assert.match(viewModel, /currentVisit\.scopeAsset\?\.id \?: currentVisit\.operationalArea\?\.id/); + assert.match(viewModel, /visit\?\.scopeAsset\?\.id \?: visit\?\.operationalArea\?\.id/); assert.match(viewModel, /repository\.fieldInventory\(currentVisit\.id, null, effectiveParentId\)/); assert.match(screen, /model\.loadFieldTypes\(item\.id\)/); });