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 50eb34d..1bd2514 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 @@ -46,3 +46,31 @@ test('F6.1 verification planning uses Area relation truth instead of Inventory o assert.match(verification, /operatorSource: 'area_company_relations'/); assert.doesNotMatch(verification, /company\.id = asset\.operator_company_id/); }); + +test('F6.1 historical operational lists read Company and Area from the parent Inspection', () => { + const acts = source('src/inspection-acts/inspection-acts.service.ts'); + const findings = source('src/inspection-findings/inspection-finding-worklist.service.ts'); + const reports = source('src/inspection-reports/inspection-reports.service.ts'); + + assert.match(acts, /visit\.operator_company_id/); + assert.match(acts, /visit\.operational_area_id/); + assert.doesNotMatch(acts, /context_asset\.operator_company_id/); + assert.match(findings, /company\.id = visit\.operator_company_id/); + assert.match(findings, /area\.id = visit\.operational_area_id/); + assert.doesNotMatch(findings, /company\.id = asset\.operator_company_id/); + assert.match(reports, /visit\.\$\{column\} = \$\{parameter\}::uuid/); + assert.match(reports, /company\.id=context_visit\.operator_company_id/); + assert.match(reports, /area\.id=context_visit\.operational_area_id/); + assert.doesNotMatch(reports, /context_asset\.operator_company_id/); +}); + +test('F6.1 WEB keeps operator selection at creation and removes it from Inventory edits', () => { + const editor = source('../web-v2/src/pages/AssetEditorPage.tsx'); + const contextPanel = source('../web-v2/src/features/assets/AssetContextHistoryPanel.tsx'); + + assert.match(editor, /createAsset\(\{[\s\S]*operatorCompanyId: operatorCompanyId \|\| null/); + assert.doesNotMatch(editor, /updateAsset\(id, \{[^}]*operatorCompanyId/); + assert.match(editor, /Snapshot histórico de alta/); + assert.match(contextPanel, /Cambiar contexto físico/); + assert.doesNotMatch(contextPanel, /operatorCompanyId:/); +});