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 15ce478..250edc0 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 @@ -75,12 +75,20 @@ test('F6.1 historical operational lists read Company and Area from the parent In assert.doesNotMatch(reports, /context_asset\.operator_company_id/); }); -test('F6.1 WEB Inventory searches use physical Area and never the operator snapshot filter', () => { +test('F6.1 WEB Inventory searches use physical scope and never the operator snapshot filter', () => { const inspectionEditor = source('../web-v2/src/pages/InspectionVisitEditorF4Page.tsx'); + const preventiveApi = source('../web-v2/src/features/inspections/preventiveCandidatesApi.ts'); + const preventiveService = source('src/inspection-visits/inspection-preventive-candidates.service.ts'); const fieldDiscoveries = source('../web-v2/src/pages/FieldDiscoveriesPage.tsx'); const inventoryMerge = source('../web-v2/src/lib/inventoryMergeApi.ts'); - for (const page of [inspectionEditor, fieldDiscoveries, inventoryMerge]) { + assert.match(inspectionEditor, /listInspectionPreventiveCandidates\(id, assetSearch\)/); + assert.match(preventiveApi, /inspection-visits\/\$\{visitId\}\/preventive-candidates/); + assert.match(preventiveService, /COALESCE\(visit\.scope_asset_id, visit\.operational_area_id\) AS "scopeAssetId"/); + assert.doesNotMatch(preventiveService, /asset\.operator_company_id/); + assert.doesNotMatch(inspectionEditor, /listAssets\(\{[\s\S]{0,300}operatorCompanyId:/); + + for (const page of [fieldDiscoveries, inventoryMerge]) { assert.match(page, /listAssets\(\{[\s\S]{0,300}operationalAreaId:/); assert.doesNotMatch(page, /listAssets\(\{[\s\S]{0,300}operatorCompanyId:/); }