mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
VBB: don't shorten stop/station names 💥✅
This commit is contained in:
parent
5ecf03f349
commit
d2bc134645
6 changed files with 50 additions and 54 deletions
|
@ -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),
|
||||
|
||||
|
|
|
@ -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 `⟲`
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
62
test/fixtures/vbb-departures.js
vendored
62
test/fixtures/vbb-departures.js
vendored
|
@ -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',
|
||||
|
|
32
test/fixtures/vbb-journeys.js
vendored
32
test/fixtures/vbb-journeys.js
vendored
|
@ -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',
|
||||
|
|
Loading…
Add table
Reference in a new issue