test(junction): preserve topology under translation
This commit is contained in:
1 parent
af286c6149
commit
a476faf171
1 file changed
+30
@@ -384,3 +384,33 @@ assert.deepEqual(
|
|||||||
'arm identity must remain stable across the -180/180 heading wrap',
|
'arm identity must remain stable across the -180/180 heading wrap',
|
||||||
);
|
);
|
||||||
assert.equal(wrappedTopology.arms.length, sixArm.topology.arms.length);
|
assert.equal(wrappedTopology.arms.length, sixArm.topology.arms.length);
|
||||||
|
|
||||||
|
const translate = (coordinate, eastMeters, northMeters) =>
|
||||||
|
point(coordinate[0] * metersPerDegree + eastMeters, coordinate[1] * metersPerDegree + northMeters);
|
||||||
|
const translatedEntries = sixArmEntries.map((entry) => ({
|
||||||
|
...entry,
|
||||||
|
line: entry.line.map((coordinate) => translate(coordinate, 120, -75)),
|
||||||
|
}));
|
||||||
|
const translatedBase = fixture('six-arm', translatedEntries);
|
||||||
|
translatedBase.helpers.junctionPlans.set('six-arm:node', {
|
||||||
|
node: translate(point(0, 0), 120, -75),
|
||||||
|
approaches: translatedBase.helpers.junctionPlans.get('six-arm:node').approaches,
|
||||||
|
});
|
||||||
|
translatedBase.helpers.junctionPlans.set('six-arm:internal', {
|
||||||
|
node: translate(point(1, 1), 120, -75),
|
||||||
|
approaches: [],
|
||||||
|
});
|
||||||
|
const translatedTopology = resolveJunctionBuildPlan(
|
||||||
|
translatedBase.model,
|
||||||
|
translatedBase.cluster,
|
||||||
|
translatedBase.helpers,
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
translatedTopology.arms.map((arm) => arm.key).sort(),
|
||||||
|
sixArm.topology.arms.map((arm) => arm.key).sort(),
|
||||||
|
'translation must not change arm identity',
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
translatedTopology.carriageways.map((item) => item.entrySection.feasibility),
|
||||||
|
sixArm.topology.carriageways.map((item) => item.entrySection.feasibility),
|
||||||
|
);
|
||||||
Reference in new issue
Block a user