test(junction): keep facilities aligned with width edits

This commit is contained in:
que01 committed 2026-09-09 11:58:53 +08:00
1 parent 6c7d81df35
commit 9b6b5b5791
1 file changed
+26 -1
+26 -1
View File
@@ -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(