From 90098d1fd532f6f386c01c54c420d9f79b5bf14c Mon Sep 17 00:00:00 2001 From: enlineawork Date: Fri, 11 Sep 2026 01:16:06 -0300 Subject: [PATCH] test: resolve planning operators from authoritative Yacimientos --- .../f6-1-inspection-yacimiento-scope-review.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api-v3/test/unit/f6-1-inspection-yacimiento-scope-review.test.ts b/api-v3/test/unit/f6-1-inspection-yacimiento-scope-review.test.ts index afc30c5..6db055c 100644 --- a/api-v3/test/unit/f6-1-inspection-yacimiento-scope-review.test.ts +++ b/api-v3/test/unit/f6-1-inspection-yacimiento-scope-review.test.ts @@ -28,7 +28,7 @@ test('F6.1 field Findings reject Inventory outside the frozen Yacimiento scope', assert.doesNotMatch(source, /AS "insideArea"/); }); -test('F6.1 planning preserves Yacimiento and never validates Inventory ownership from Company snapshot', () => { +test('F6.1 planning preserves Yacimiento and never validates descendant Inventory ownership', () => { const source = api('src/inspection-visits/inspection-visits.service.ts'); assert.match(source, /const nextScope = dto\.scopeAssetId === undefined \? visit\.scopeAssetId : dto\.scopeAssetId/); @@ -38,7 +38,6 @@ test('F6.1 planning preserves Yacimiento and never validates Inventory ownership assert.doesNotMatch(source, /visit\.scopeAssetId = nextAreaId/); assert.doesNotMatch(source, /assertAssetsMatchContext/); assert.doesNotMatch(source, /assertCurrentAssetsMatchContext/); - assert.doesNotMatch(source, /asset\.operator_company_id IS DISTINCT FROM/); }); test('F6.1 creation selects actionable checklist Inventory automatically', () => { @@ -49,14 +48,17 @@ test('F6.1 creation selects actionable checklist Inventory automatically', () => assert.match(source, /'AUTO_INCLUDED'/); }); -test('F6.1 operator choices are resolved at the planned timestamp', () => { +test('Authoritative operator choices are projected from Yacimientos of the selected Area', () => { const hierarchy = api('src/inspection-visits/inspection-planning-hierarchy.service.ts'); const controller = api('src/inspection-visits/inspection-visits.controller.ts'); const createPage = web('src/pages/InspectionVisitCreateF61Page.tsx'); assert.match(hierarchy, /operatorsForArea\([\s\S]*at\?: string/); - assert.match(hierarchy, /relation\.valid_from <= \$2::timestamptz/); - assert.match(hierarchy, /relation\.valid_until > \$2::timestamptz/); + assert.match(hierarchy, /FROM assets yacimiento/); + assert.match(hierarchy, /yacimiento\.parent_id=\$1::uuid/); + assert.match(hierarchy, /yacimiento\.operator_company_id/); + assert.match(hierarchy, /SELECT DISTINCT company\.id/); + assert.doesNotMatch(hierarchy, /FROM area_company_relations relation/); assert.match(controller, /@Query\('at'\) at\?: string/); assert.match(createPage, /operators\?at=\$\{at\}/); assert.match(createPage, /\[areaId, plannedStartAt\]/);