mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
feat(transit): add Guelph and Kingston, register Barrie off
Guelph's feed publishes the internal database key of a route (`2991`) where the rider sees the number on the bus (`1`), which would have put "Route 2991" on the label a person reads. So a feed may now carry its own `routeLabel`, the same way it may carry its own `modeWords`. Guelph's table is its 33 routes, taken from the City's own published GTFS; an id missing from it renders unchanged, because a raw id you can compare against the bus beats a blank. Every other feed is identity and carries no table. Kingston is catalogued by the City against this exact URL. Its licence PDF link is pinned to the canonical location rather than the legacy path that currently redirects there — Durham's entry records what happens when such a redirect is eventually dropped. Barrie ships REGISTERED AND OFF. The City offers its licence for acceptance behind a click-through gate, and nobody on this project has accepted it. Whether to accept is a person's decision, not an assumption a poller should make, so the feed is visible, documented, and one line from enabled.
This commit is contained in:
1 parent
849cb80375
commit
11dd914c2f
7 files changed
+223
-9
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
transitFeedsInRange,
|
||||
transitModeFor,
|
||||
transitModeResolved,
|
||||
transitRouteLabel,
|
||||
} from './transitFeeds.js';
|
||||
|
||||
test('every registered feed is keyless, https, licensed, and uniquely identified', () => {
|
||||
@@ -346,3 +347,46 @@ test('every Golden Horseshoe feed is documented with its licence', () => {
|
||||
}
|
||||
assert.match(sources, /Durham Region Transit publishes no bearing/);
|
||||
});
|
||||
|
||||
test('a feed whose route ids are internal database keys can name its routes', () => {
|
||||
// Guelph's realtime feed emits `2991` where the rider sees route `1`. A feed
|
||||
// that knows the difference translates it; every other feed is unaffected.
|
||||
const guelph = getTransitFeed('guelph-transit');
|
||||
assert.equal(transitRouteLabel(guelph, '2991'), '1');
|
||||
assert.equal(transitRouteLabel(guelph, '3016'), '99');
|
||||
assert.equal(transitRouteLabel(guelph, '3007'), '50 U');
|
||||
assert.equal(transitRouteLabel(guelph, '3017'), '99Lite');
|
||||
});
|
||||
|
||||
test('an unknown or absent route id survives translation unchanged', () => {
|
||||
const guelph = getTransitFeed('guelph-transit');
|
||||
// A route added after this table was built must still render its raw id
|
||||
// rather than vanish or read as "undefined".
|
||||
assert.equal(transitRouteLabel(guelph, '4242'), '4242');
|
||||
assert.equal(transitRouteLabel(guelph, null), null);
|
||||
assert.equal(transitRouteLabel(guelph, ''), '');
|
||||
});
|
||||
|
||||
test('a feed with rider-facing route ids is left alone', () => {
|
||||
// TTC and Kingston publish the route a rider would say, so translation is
|
||||
// identity for them and no table is carried.
|
||||
assert.equal(transitRouteLabel(getTransitFeed('ttc-toronto'), '501'), '501');
|
||||
assert.equal(transitRouteLabel(getTransitFeed('mbta'), 'Red'), 'Red');
|
||||
assert.equal(transitRouteLabel(null, '7'), '7');
|
||||
});
|
||||
|
||||
test('Barrie is registered but unpolled until its licence is accepted', () => {
|
||||
// The City offers these terms for acceptance behind a click-through gate.
|
||||
// Registered-but-off is how that decision stays visible and one line from
|
||||
// reversible, rather than being made silently by a poller.
|
||||
assert.equal(
|
||||
getRegisteredTransitFeed('barrie-transit')?.name,
|
||||
'Barrie Transit',
|
||||
);
|
||||
assert.equal(getTransitFeed('barrie-transit'), null, 'not routable');
|
||||
assert.equal(
|
||||
publicTransitCatalog().some((feed) => feed.id === 'barrie-transit'),
|
||||
false,
|
||||
'never offered to the browser',
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user