mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix: say when bike share, transit and place limits leave results out
Bike share and transit read only the three nearest systems, and place search returns at most five matches within 50 km, while answers read as complete. Answers now name the systems not searched and say when a place search limit may have left places out.
This commit is contained in:
1 parent
56f0d2e203
commit
302a1c1995
4 files changed
+112
-11
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { composeCatalog, coreTools } from '../index.js';
|
||||
import { GBFS_CITY_REGISTRY } from '../../layers/bikeshare/registry.js';
|
||||
|
||||
const system = (id, city, centerLat, centerLon) => ({
|
||||
id,
|
||||
@@ -404,3 +405,26 @@ test('transit marks stale feeds and drops expired positions', async () => {
|
||||
'1 transit vehicle in 2 km around 30.267, -97.743 (1 feed stale; positions may be out of date).',
|
||||
);
|
||||
});
|
||||
|
||||
test('bike share names the systems it did not search', async () => {
|
||||
const empty = { data: { stations: [] } };
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: {
|
||||
bikeshare: {
|
||||
systems: GBFS_CITY_REGISTRY,
|
||||
getStations: async () => empty,
|
||||
},
|
||||
},
|
||||
});
|
||||
// New York, Philadelphia, Washington and Boston.
|
||||
const result = await catalog.call('get_bike_share', {
|
||||
area: { bbox: [-77.5, 38.5, -70.5, 42.8] },
|
||||
});
|
||||
assert.equal(result.data.systems.length, 3);
|
||||
assert.ok(result.data.systems_not_searched.length >= 1);
|
||||
assert.match(
|
||||
result.summary,
|
||||
/more not searched: .*; use a smaller area\)\.$/,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user