From 75bdfbe6078768941fa45da2ceef2576c2b0a2f5 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 9 Sep 2026 09:57:14 +0800 Subject: [PATCH] test(junction): cover known island exclusions --- test/index.js | 12 ++++++++++++ test/junction-build-plan-counterexamples.js | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/test/index.js b/test/index.js index 99c6348..41f5fc0 100644 --- a/test/index.js +++ b/test/index.js @@ -66,6 +66,18 @@ const model = compiler.nativeRoad.compileRoadModel(fs.readFileSync(fixture, 'utf overrides: [], }); assert.equal(model.roads.length, 24); +const islandModel = compiler.nativeRoad.compileRoadModel( + ` + + + + `, + { schema: 'native-road-overrides/v1', overrides: [] }, +); +assert.deepEqual( + islandModel.exclusionRegions.map((region) => [region.id, region.source]), + [['island', 'osm-traffic-island']], +); const complexModel = compiler.nativeRoad.compileRoadModel(fs.readFileSync(fixture, 'utf8'), { schema: 'native-road-overrides/v1', overrides: [], diff --git a/test/junction-build-plan-counterexamples.js b/test/junction-build-plan-counterexamples.js index af315f9..94cc3f0 100644 --- a/test/junction-build-plan-counterexamples.js +++ b/test/junction-build-plan-counterexamples.js @@ -126,6 +126,15 @@ const teeCore = buildCoreClosure(tee.topology, teeBoundaryGraph, point(0, 0)); assert.equal(teeCore.status, 'supported'); assert.equal(teeCore.sharedEdgeRefs.length, teeBoundaryGraph.sections.length); assert.ok(teeCore.ring.every((coordinate) => coordinate.every(Number.isFinite))); +const exclusionRing = [point(-1, -1), point(1, -1), point(1, 1), point(-1, 1), point(-1, -1)]; +const teeWithIsland = buildJunctionBoundaryGraph( + tee.topology, + point(0, 0), + { outerRadiusFor: () => 30, innerRadiusFor: () => 10 }, + tee.helpers, + [{ id: 'island:known', ring: exclusionRing }], +); +assert.equal(buildCoreClosure(tee.topology, teeWithIsland, point(0, 0)).reason, 'known-exclusion-region'); // Offset and unequal-width approaches preserve individual source sections and // local section tangents rather than a single arm envelope.