From 9b6b5b57913b781fefc9ce624ae9e667c944c3f5 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 9 Sep 2026 11:58:53 +0800 Subject: [PATCH] test(junction): keep facilities aligned with width edits --- test/workbench-edit-api.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/workbench-edit-api.js b/test/workbench-edit-api.js index 84b20d5..15c9faf 100644 --- a/test/workbench-edit-api.js +++ b/test/workbench-edit-api.js @@ -289,7 +289,13 @@ assert.deepEqual( clusterState.junctionStructure, 'preview and persisted compiler structure agree', ); -const complexWidthHandle = clusterState.handles.handles[0]; +const complexWidthHandle = clusterState.handles.handles.find( + (handle) => + handle.kind === 'cluster-carriageway-width' && + clusterPreview.layers.vehicleStopLines.features.some( + (feature) => feature.properties.carriageway_key === handle.anchor.carriagewayKey, + ), +); const complexWidthConstraint = { id: 'constraint:complex-width', kind: 'cluster-carriageway-width', @@ -340,6 +346,25 @@ assert.notDeepEqual( [baselineApproachRing[1], baselineApproachRing[2]], 'a local width correction must taper into the edited inner section', ); +const editedArmKey = complexSurface(clusterPreview).properties.arm_key; +const crosswalkForArm = (preview) => + preview.layers.crosswalks.features.find((feature) => feature.properties.arm_key === editedArmKey); +const stopLineForCarriageway = (preview) => + preview.layers.vehicleStopLines.features.find( + (feature) => feature.properties.carriageway_key === complexWidthHandle.anchor.carriagewayKey, + ); +assert.ok(crosswalkForArm(clusterPreview), 'the edited arm must retain a crosswalk envelope'); +assert.notEqual( + crosswalkForArm(widenedClusterPreview).properties.span_m, + crosswalkForArm(clusterPreview).properties.span_m, + 'a local width correction must update its final crosswalk envelope', +); +assert.ok(stopLineForCarriageway(clusterPreview), 'the edited carriageway must retain its stop line'); +assert.notDeepEqual( + stopLineForCarriageway(widenedClusterPreview).geometry, + stopLineForCarriageway(clusterPreview).geometry, + 'a local width correction must update its final stop-line geometry', +); const complexCrossingHandle = clusterState.handles.handles.find((handle) => handle.kind === 'cluster-crossing-inset'); assert.ok(complexCrossingHandle, 'the complex fixture must publish grouped crossing handles'); const renderedComplexCrosswalk = clusterPreview.layers.crosswalks.features.find(