From dec79b6fcff1214a75b68d750b63fa956af55604 Mon Sep 17 00:00:00 2001 From: ulihhhh <54112476+ulihhhh@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:20:52 +0200 Subject: [PATCH] test(bikeshare): pin the Barcelona load radii to their outermost stations The map range check floors every radius at 100 km, so the station test passed with any loadRadiusKm up to that. get_bike_share uses the radius as registered, so assert each system's radius reaches the stations it lists. Co-Authored-By: Claude Opus 5.5 --- .../bikeshare/barcelonaSystems.test.mjs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/layers/bikeshare/barcelonaSystems.test.mjs b/src/layers/bikeshare/barcelonaSystems.test.mjs index 992c0431c..cdca11307 100644 --- a/src/layers/bikeshare/barcelonaSystems.test.mjs +++ b/src/layers/bikeshare/barcelonaSystems.test.mjs @@ -70,6 +70,26 @@ test('a camera over each outermost station activates its system', () => { } }); +test('each load radius reaches its outermost stations', () => { + // The range check floors every radius at 100 km, so the test above passes + // with any loadRadiusKm; get_bike_share uses the radius as registered. + for (const [id, expected] of Object.entries(SYSTEMS)) { + const system = CITY_BY_ID.get(id); + for (const station of expected.stations) { + const distance = parts.model.haversineKm( + system.centerLat, + system.centerLon, + station.lat, + station.lon, + ); + assert.ok( + distance <= system.loadRadiusKm, + `${station.name} is ${distance.toFixed(1)} km from the ${id} centre`, + ); + } + } +}); + test('a camera over central Barcelona activates both systems', () => { // Plaça de Catalunya. const active = computeInRangeCities({ lat: 41.387, lon: 2.17 });