test(junction): isolate foreign junction plans

This commit is contained in:
que01 committed 2026-09-09 13:26:16 +08:00
1 parent 9af3afcbbd
commit a090cb1e58
1 file changed
+29
@@ -431,3 +431,32 @@ const tooShortSection = tooShortGraph.sections.find(
);
assert.equal(tooShortSection.transitionStatus, 'insufficient-source-length');
assert.equal(tooShortSection.transitionMeters, 0);
// Foreign junction plans outside the selected cluster must not leak into its
// topology or change stable source identities.
const isolatedHelpers = {
...sixArm.helpers,
junctionPlans: new Map([
...sixArm.helpers.junctionPlans,
[
'foreign:node',
{
node: point(500, 500),
approaches: [
{
segmentId: 'foreign:segment',
roadIds: ['foreign:road'],
widthMeters: 20,
line: [point(500, 500), point(560, 500)],
},
],
},
],
]),
};
const isolatedTopology = resolveJunctionBuildPlan(sixArm.model, sixArm.cluster, isolatedHelpers);
assert.deepEqual(
isolatedTopology.carriageways.map((item) => item.key).sort(),
sixArm.topology.carriageways.map((item) => item.key).sort(),
'foreign junction plans must not contaminate selected cluster topology',
);