From d2bc134645f3691a097f06cee572374a4d0a3d0a Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 29 Dec 2021 18:16:51 +0100 Subject: [PATCH] =?UTF-8?q?VBB:=20don't=20shorten=20stop/station=20names?= =?UTF-8?q?=20=F0=9F=92=A5=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p/vbb/index.js | 2 -- p/vbb/readme.md | 1 - package.json | 3 +- test/e2e/vbb.js | 4 +-- test/fixtures/vbb-departures.js | 62 ++++++++++++++++----------------- test/fixtures/vbb-journeys.js | 32 ++++++++--------- 6 files changed, 50 insertions(+), 54 deletions(-) diff --git a/p/vbb/index.js b/p/vbb/index.js index f9c77853..dd2e5a04 100644 --- a/p/vbb/index.js +++ b/p/vbb/index.js @@ -1,6 +1,5 @@ 'use strict' -const shorten = require('vbb-short-station-name') const parseLineName = require('vbb-parse-line') const parseTicket = require('vbb-parse-ticket') const {parseHook} = require('../../lib/profile-hooks') @@ -77,7 +76,6 @@ const vbbProfile = { parseLine: parseHook(_parseLine, parseLineWithMoreDetails), parseLocation: parseHook(_parseLocation, parseLocation), - parseStationName: (ctx, name) => shorten(name), parseJourney: parseHook(_parseJourney, parseJourneyWithTickets), parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn), diff --git a/p/vbb/readme.md b/p/vbb/readme.md index 51d4c0eb..7c774e36 100644 --- a/p/vbb/readme.md +++ b/p/vbb/readme.md @@ -16,7 +16,6 @@ const client = createClient(vbbProfile, 'my-awesome-program') ## Customisations - parses *VBB*-specific products (such as *X-Bus*) -- strips parts from station names that are unnecessary in the Berlin context - parses line names to give more information (e.g. "Is it an express bus?") - parses *VBB*-specific tickets - renames *Ringbahn* line names to contain `⟳` and `⟲` diff --git a/package.json b/package.json index 9b2d99e0..21d21801 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,7 @@ "qs": "^6.6.0", "slugg": "^1.2.0", "vbb-parse-line": "^1.0.0", - "vbb-parse-ticket": "^0.2.1", - "vbb-short-station-name": "^1.0.1" + "vbb-parse-ticket": "^0.2.1" }, "devDependencies": { "eslint": "^7.0.0", diff --git a/test/e2e/vbb.js b/test/e2e/vbb.js index df3b7897..7880bbfc 100644 --- a/test/e2e/vbb.js +++ b/test/e2e/vbb.js @@ -359,13 +359,13 @@ tap.test('nearby', async (t) => { validate(t, nearby, 'locations', 'nearby') t.equal(nearby[0].id, berlinerStr) - t.equal(nearby[0].name, 'U Berliner Str.') + t.equal(nearby[0].name, 'U Berliner Str. (Berlin)') t.ok(nearby[0].distance > 0) t.ok(nearby[0].distance < 100) const res = nearby.find(s => s.id === landhausstr) t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`) - t.equal(nearby[1].name, 'Landhausstr.') + t.equal(nearby[1].name, 'Landhausstr. (Berlin)') t.ok(nearby[1].distance > 100) t.ok(nearby[1].distance < 200) diff --git a/test/fixtures/vbb-departures.js b/test/fixtures/vbb-departures.js index bd353010..a606df73 100644 --- a/test/fixtures/vbb-departures.js +++ b/test/fixtures/vbb-departures.js @@ -7,7 +7,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -197,13 +197,13 @@ module.exports = [ platform: '3', plannedPlatform: '3', prognosisType: 'calculated', - direction: 'S Erkner', + direction: 'S Erkner Bhf', origin: null, destination: { type: "stop", id: "900310004", stationDHID: 'de:12067:900310004', - name: "S Erkner", + name: "S Erkner Bhf", location: { type: "location", id: "900310004", @@ -282,7 +282,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -527,7 +527,7 @@ module.exports = [ type: "stop", id: "900005207", stationDHID: 'de:11000:900005207', - name: "Philharmonie Süd", + name: "Philharmonie Süd (Berlin)", location: { type: "location", id: "900005207", @@ -556,7 +556,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -746,7 +746,7 @@ module.exports = [ platform: null, plannedPlatform: null, prognosisType: 'prognosed', - direction: 'S+U Hermannstr.', + direction: 'S+U Hermannstr. (Berlin)', provenance: null, line: { type: 'line', @@ -802,7 +802,7 @@ module.exports = [ type: "stop", id: "900079221", stationDHID: 'de:11000:900079221', - name: "S+U Hermannstr.", + name: "S+U Hermannstr. (Berlin)", location: { type: "location", id: "900079221", @@ -831,7 +831,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -1077,7 +1077,7 @@ module.exports = [ type: 'stop', id: '900096197', stationDHID: 'de:11000:900096197', - name: 'S+U Wittenau [U8]', + name: 'S+U Wittenau (Berlin) [U8]', location: { type: 'location', id: '900096197', @@ -1106,7 +1106,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -1296,7 +1296,7 @@ module.exports = [ platform: '4', plannedPlatform: '4', prognosisType: 'calculated', - direction: 'S Westkreuz', + direction: 'S Westkreuz (Berlin)', provenance: null, line: { type: 'line', @@ -1352,7 +1352,7 @@ module.exports = [ type: 'stop', id: '900024102', stationDHID: 'de:11000:900024102', - name: 'S Westkreuz', + name: 'S Westkreuz (Berlin)', location: { type: 'location', id: '900024102', @@ -1381,7 +1381,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -1571,7 +1571,7 @@ module.exports = [ platform: '3', plannedPlatform: '3', prognosisType: 'calculated', - direction: 'S Ahrensfelde', + direction: 'S Ahrensfelde Bhf (Berlin)', provenance: null, line: { type: 'line', @@ -1627,7 +1627,7 @@ module.exports = [ type: 'stop', id: '900170004', stationDHID: 'de:11000:900170004', - name: 'S Ahrensfelde', + name: 'S Ahrensfelde Bhf (Berlin)', location: { type: 'location', id: '900170004', @@ -1656,7 +1656,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -1931,7 +1931,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -2121,7 +2121,7 @@ module.exports = [ platform: '3', plannedPlatform: '3', prognosisType: 'calculated', - direction: 'S Strausberg', + direction: 'S Strausberg Bhf', provenance: null, line: { type: 'line', @@ -2177,7 +2177,7 @@ module.exports = [ type: 'stop', id: '900320004', stationDHID: 'de:12064:900320004', - name: 'S Strausberg', + name: 'S Strausberg Bhf', location: { type: 'location', id: '900320004', @@ -2206,7 +2206,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -2396,7 +2396,7 @@ module.exports = [ platform: null, plannedPlatform: null, prognosisType: 'prognosed', - direction: 'S+U Hermannstr.', + direction: 'S+U Hermannstr. (Berlin)', provenance: null, line: { type: 'line', @@ -2452,7 +2452,7 @@ module.exports = [ type: 'stop', id: '900079221', stationDHID: 'de:11000:900079221', - name: 'S+U Hermannstr.', + name: 'S+U Hermannstr. (Berlin)', location: { type: 'location', id: '900079221', @@ -2481,7 +2481,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -2671,7 +2671,7 @@ module.exports = [ platform: null, plannedPlatform: null, prognosisType: 'prognosed', - direction: 'U Paracelsus-Bad', + direction: 'U Paracelsus-Bad (Berlin)', provenance: null, line: { type: 'line', @@ -2727,7 +2727,7 @@ module.exports = [ type: 'stop', id: '900085104', stationDHID: 'de:11000:900085104', - name: 'U Paracelsus-Bad', + name: 'U Paracelsus-Bad (Berlin)', location: { type: 'location', id: '900085104', @@ -2756,7 +2756,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -3001,7 +3001,7 @@ module.exports = [ type: 'stop', id: '900120004', stationDHID: 'de:11000:900120004', - name: 'S+U Warschauer Str.', + name: 'S+U Warschauer Str. (Berlin)', location: { type: 'location', id: '900120004', @@ -3030,7 +3030,7 @@ module.exports = [ type: 'stop', id: '900100004', stationDHID: 'de:11000:900100004', - name: 'S+U Jannowitzbrücke', + name: 'S+U Jannowitzbrücke (Berlin)', location: { type: 'location', id: '900100004', @@ -3220,7 +3220,7 @@ module.exports = [ platform: '4', plannedPlatform: '4', prognosisType: 'calculated', - direction: 'S Spandau', + direction: 'S Spandau Bhf (Berlin)', provenance: null, line: { type: 'line', @@ -3276,7 +3276,7 @@ module.exports = [ type: 'stop', id: '900029101', stationDHID: 'de:11000:900029101', - name: 'S Spandau', + name: 'S Spandau Bhf (Berlin)', location: { type: 'location', id: '900029101', diff --git a/test/fixtures/vbb-journeys.js b/test/fixtures/vbb-journeys.js index 524e355f..942bd7bc 100644 --- a/test/fixtures/vbb-journeys.js +++ b/test/fixtures/vbb-journeys.js @@ -6,7 +6,7 @@ module.exports = [{ origin: { type: 'stop', id: '900042101', - name: 'U Spichernstr.', + name: 'U Spichernstr. (Berlin)', location: { type: 'location', id: '900042101', @@ -26,7 +26,7 @@ module.exports = [{ destination: { type: 'stop', id: '900001201', - name: 'S+U Westhafen', + name: 'S+U Westhafen (Berlin)', location: { type: 'location', id: '900001201', @@ -74,7 +74,7 @@ module.exports = [{ express: false, night: false, }, - direction: 'U Osloer Str.', + direction: 'U Osloer Str. (Berlin)', arrivalPlatform: null, plannedArrivalPlatform: null, departurePlatform: null, @@ -84,7 +84,7 @@ module.exports = [{ origin: { type: 'stop', id: '900001201', - name: 'S+U Westhafen', + name: 'S+U Westhafen (Berlin)', location: { type: 'location', id: '900001201', @@ -104,7 +104,7 @@ module.exports = [{ destination: { type: 'stop', id: '900007102', - name: 'S+U Gesundbrunnen', + name: 'S+U Gesundbrunnen Bhf (Berlin)', location: { type: 'location', id: '900007102', @@ -162,7 +162,7 @@ module.exports = [{ origin: { type: 'stop', id: '900007102', - name: 'S+U Gesundbrunnen', + name: 'S+U Gesundbrunnen Bhf (Berlin)', location: { type: 'location', id: '900007102', @@ -182,7 +182,7 @@ module.exports = [{ destination: { type: 'stop', id: '900350127', - name: 'Eberswalde, Hbf', + name: 'Eberswalde, Hauptbahnhof', location: { type: 'location', id: '900350127', @@ -226,7 +226,7 @@ module.exports = [{ express: false, night: false, }, - direction: 'Ostseebad Binz, Bhf', + direction: 'Ostseebad Binz, Bahnhof', arrivalPlatform: '3', plannedArrivalPlatform: '3', departurePlatform: '10', @@ -306,7 +306,7 @@ module.exports = [{ origin: { type: 'stop', id: '900042101', - name: 'U Spichernstr.', + name: 'U Spichernstr. (Berlin)', location: { type: 'location', id: '900042101', @@ -326,7 +326,7 @@ module.exports = [{ destination: { type: 'stop', id: '900001201', - name: 'S+U Westhafen', + name: 'S+U Westhafen (Berlin)', location: { type: 'location', id: '900001201', @@ -374,7 +374,7 @@ module.exports = [{ express: false, night: false, }, - direction: 'U Osloer Str.', + direction: 'U Osloer Str. (Berlin)', arrivalPlatform: null, plannedArrivalPlatform: null, departurePlatform: null, @@ -384,7 +384,7 @@ module.exports = [{ origin: { type: 'stop', id: '900001201', - name: 'S+U Westhafen', + name: 'S+U Westhafen (Berlin)', location: { type: 'location', id: '900001201', @@ -404,7 +404,7 @@ module.exports = [{ destination: { type: 'stop', id: '900007102', - name: 'S+U Gesundbrunnen', + name: 'S+U Gesundbrunnen Bhf (Berlin)', location: { type: 'location', id: '900007102', @@ -463,7 +463,7 @@ module.exports = [{ origin: { type: 'stop', id: '900007102', - name: 'S+U Gesundbrunnen', + name: 'S+U Gesundbrunnen Bhf (Berlin)', location: { type: 'location', id: '900007102', @@ -483,7 +483,7 @@ module.exports = [{ destination: { type: 'stop', id: '900350127', - name: 'Eberswalde, Hbf', + name: 'Eberswalde, Hauptbahnhof', location: { type: 'location', id: '900350127', @@ -527,7 +527,7 @@ module.exports = [{ express: true, night: false, }, - direction: 'Stralsund, Hbf', + direction: 'Stralsund, Hauptbahnhof', arrivalPlatform: '3', plannedArrivalPlatform: '3', departurePlatform: '9',