From 301dee2174a384582df6475a99b4af16bc412332 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 02:14:59 +0400 Subject: [PATCH] Register TransLink Cairns through transitFeed and drop tests that restate data --- src/data/transitFeeds.js | 10 ++++------ src/data/transitFeedsAustralia.test.mjs | 19 +------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/data/transitFeeds.js b/src/data/transitFeeds.js index cb1b10398b..96f33a85f8 100644 --- a/src/data/transitFeeds.js +++ b/src/data/transitFeeds.js @@ -479,7 +479,6 @@ function translinkRouteMode(routeId) { * @returns {string|null} */ function translinkRouteLabel(routeId) { - if (!routeId) return routeId; const route = routeId.replace(/-\d+$/, ''); const cairns = /^C(\d+)$/.exec(route); return cairns ? cairns[1] : route; @@ -970,23 +969,22 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([ routeMode: translinkRouteMode, routeLabel: translinkRouteLabel, }), - Object.freeze({ + transitFeed({ id: 'translink-cairns', name: 'TransLink', operator: 'TransLink (Queensland Government)', region: 'Cairns, Australia', - center: Object.freeze({ lat: -16.9186, lon: 145.7781 }), + center: { lat: -16.9186, lon: 145.7781 }, loadRadiusKm: 60, url: 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', license: 'CC BY 4.0', licenseUrl: 'https://translink.com.au/about-translink/open-data', attribution: 'Translink, Department of Transport and Main Roads', - defaultEnabled: true, - terms: Object.freeze({ + terms: { quote: 'Our data is licensed under a Creative Commons Attribution 4.0 International License. Authentication is not required to use the feed.', note: 'The same open-data page lists Cairns (CNS) vehicle positions beside South East Queensland; same terms, text-only credit.', - }), + }, defaultMode: 'bus', routeMode: translinkRouteMode, routeLabel: translinkRouteLabel, diff --git a/src/data/transitFeedsAustralia.test.mjs b/src/data/transitFeedsAustralia.test.mjs index 6edd74b947..f4a3d379ef 100644 --- a/src/data/transitFeedsAustralia.test.mjs +++ b/src/data/transitFeedsAustralia.test.mjs @@ -13,19 +13,12 @@ import { // Route ids below are as published in the live feeds and the operators' // static routes.txt (checked 16 Oct 2026). -test('TransLink feeds are keyless, routable and cover their own city only', () => { - const seq = getTransitFeed('translink-seq'); +test('TransLink Cairns is routable and each TransLink feed covers its own city', () => { const cairns = getTransitFeed('translink-cairns'); assert.equal( cairns.url, 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', ); - for (const feed of [seq, cairns]) { - assert.equal(feed.headers, undefined, `${feed.id} needs no extra header`); - } - for (const feed of [seq, cairns]) { - assert.equal(feed.license, 'CC BY 4.0'); - } const ids = (lat, lon) => transitFeedsInRange(lat, lon).map((f) => f.id); assert.deepEqual(ids(-27.4698, 153.0251), ['translink-seq']); assert.deepEqual(ids(-16.9186, 145.7781), ['translink-cairns']); @@ -111,14 +104,4 @@ test('DATA_SOURCES documents the TransLink feeds in the transit row style', () = /published for developer use and not against their use/, ); assert.doesNotMatch(translink, /licen[cs]e|CC BY|terms/i); - // The Rail layer documents Adelaide Metro in a row of its own. - const adelaide = rows.filter( - (line) => - line.startsWith('| **Adelaide Metro**') && /Transit layer/.test(line), - ); - assert.equal( - adelaide.length, - 1, - 'one Adelaide Metro Transit row', - ); });