From 0251e314cc5d4e8d901d4dc5f5d2e9de938d2edf Mon Sep 17 00:00:00 2001 From: Jannis R Date: Sat, 15 Feb 2020 19:17:27 +0000 Subject: [PATCH] DB parseLocation() test: expect sub-stops, facilities, foreign IDs :white_check_mark: --- test/db-stop.js | 2 + test/fixtures/db-stop.js | 613 ++++++++++++++++++++++++++++++++++- test/fixtures/sncb-stop.json | 260 +++++++++++++++ 3 files changed, 873 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/sncb-stop.json diff --git a/test/db-stop.js b/test/db-stop.js index 7cb8d62c..df692e77 100644 --- a/test/db-stop.js +++ b/test/db-stop.js @@ -14,6 +14,8 @@ const {profile} = client const opt = { linesOfStops: false, // parse & expose lines at the stop/station? + subStops: true, + entrances: true, remarks: true, } diff --git a/test/fixtures/db-stop.js b/test/fixtures/db-stop.js index 979c4f78..a997e0b9 100644 --- a/test/fixtures/db-stop.js +++ b/test/fixtures/db-stop.js @@ -1,11 +1,63 @@ 'use strict' +const facilities = { + '3SZentrale': '030/2971055', + parkingLots: true, + bicycleParkingRacks: true, + localPublicTransport: true, + toilets: true, + lockers: true, + travelShop: false, + stepFreeAccess: true, + boardingAid: 'ja, um voranmeldung unter 01806 512 512* wird gebeten', + taxis: true, + raw: [ + ['DB Information', '06:00 - 22:30'], + ['3-S-Zentrale', '030/2971055'], + ['Parkplätze', 'Ja'], + ['Fahrrad-Stellplätze', 'Ja'], + ['ÖPNV-Anbindung', 'Ja'], + ['WC', 'Ja'], + ['Schließfächer', 'Ja'], + ['Reisebedarf', 'Nein'], + ['Stufenfreier Zugang', 'Ja'], + [ + 'Ein-/ Umsteigehilfe', + 'Ja, um Voranmeldung unter 01806 512 512* wird gebeten' + ], + ['Taxi am Bahnhof', 'Ja'], + [ + 'Hinweis', + '*20 ct/Anruf aus dem Festnetz, Tarif bei Mobilfunk max. 60 ct/Anruf, täglich von 6:00 bis 22:00 Uhr für Sie erreichbar.' + ] + ], +} + +const reisezentrumOpeningHours = { + Mo: '08:00-20:00', + Di: '08:00-20:00', + Mi: '08:00-20:00', + Do: '08:00-20:00', + Fr: '08:00-20:00', + Sa: '10:00-18:00', + So: '10:00-18:00', + raw: [ + ['Mo', '08:00-20:00'], + ['Di', '08:00-20:00'], + ['Mi', '08:00-20:00'], + ['Do', '08:00-20:00'], + ['Fr', '08:00-20:00'], + ['Sa', '10:00-18:00'], + ['So', '10:00-18:00'] + ], +} + module.exports = { - type: 'stop', + type: 'station', id: '8011155', ids: { dhid: 'de:11000:900100003', - VBB: '900100003' + VBB: '900100003', }, name: 'Berlin Alexanderplatz', location: { @@ -26,5 +78,562 @@ module.exports = { tram: true, taxi: false }, + stops: [{ + type: 'stop', + id: '372948', + ids: { + dhid: 'de:11000:900100731', + VBB: '900100731', + }, + name: 'Alexanderpl (S+U)/Memhardstr.[4-5], Berlin', + location: { + type: 'location', + id: '372948', + latitude: 52.523513, + longitude: 13.411366 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '727273', + ids: { + dhid: 'de:11000:900100026', + VBB: '900100026', + }, + name: 'Alexanderplatz Bahnhof (S+U)/Gontardstr., Berlin', + location: { + type: 'location', + id: '727273', + latitude: 52.52087, + longitude: 13.411609 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '727460', + ids: { + dhid: 'de:11000:900100024', + VBB: '900100024', + }, + name: 'Alexanderplatz Bahnhof (S+U)/Dircksenstr., Berlin', + location: { + type: 'location', + id: '727460', + latitude: 52.521967, + longitude: 13.41116 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '727484', + ids: { + dhid: 'de:11000:900100031', + VBB: '900100031', + }, + name: 'Alexanderplatz Bahnhof (S+U)/Memhardstr., Berlin', + location: { + type: 'location', + id: '727484', + latitude: 52.522722, + longitude: 13.410288 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '728658', + ids: { + dhid: 'de:11000:900100707', + VBB: '900100707', + }, + name: 'Alexanderplatz [Bus] (U), Berlin', + location: { + type: 'location', + id: '728658', + latitude: 52.52318, + longitude: 13.413946 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities + }, { + type: 'stop', + id: '728659', + ids: { + dhid: 'de:11000:900100703', + VBB: '900100703', + }, + name: 'Alexanderplatz [U2] (S+U), Berlin', + location: { + type: 'location', + id: '728659', + latitude: 52.521742, + longitude: 13.414045 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '728660', + ids: { + dhid: 'de:11000:900100704', + VBB: '900100704', + }, + name: 'Alexanderplatz [U5] (S+U), Berlin', + location: { + type: 'location', + id: '728660', + latitude: 52.521661, + longitude: 13.414045 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '728735', + ids: { + dhid: 'de:11000:900100712', + VBB: '900100712', + }, + name: 'Alexanderpl. (S+U)/Grunerstr. [Alexanderstr.], Ber', + location: { + type: 'location', + id: '728735', + latitude: 52.520322, + longitude: 13.415708 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities + }, { + type: 'stop', + id: '732533', + ids: { + dhid: 'de:11000:900100705', + VBB: '900100705', + }, + name: 'Alexanderplatz [U8] (S+U), Berlin', + location: { + type: 'location', + id: '732533', + latitude: 52.521023, + longitude: 13.412661 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '732535', + ids: { + dhid: 'de:11000:900100005', + VBB: '900100005', + }, + name: 'Alexanderplatz [Tram] (U), Berlin', + location: { + type: 'location', + id: '732535', + latitude: 52.522119, + longitude: 13.414683 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities + }, { + type: 'stop', + id: '732536', + ids: { + dhid: 'de:11000:900100711', + VBB: '900100711', + }, + name: 'Alexanderplatz (S+U)/Grunerstr., Berlin', + location: { + type: 'location', + id: '732536', + latitude: 52.520825, + longitude: 13.414926 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities + }, { + type: 'stop', + id: '8089001', + ids: { + dhid: 'de:11000:900100003', + VBB: '900100003', + }, + name: 'Berlin Alexanderplatz (S)', + location: { + type: 'location', + id: '8089001', + latitude: 52.521643, + longitude: 13.411097 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: true, + suburban: true, + bus: true, + ferry: false, + subway: true, + tram: true, + taxi: false + }, + transitAuthority: 'VBB', + facilities, + reisezentrumOpeningHours, + }, { + type: 'stop', + id: '732594', + ids: { + VBB: '900100517', + }, + name: 'Otto-Braun-Str./Alexanderplatz, Berlin', + location: { + type: 'location', + id: '732594', + latitude: 52.522066, + longitude: 13.41658 + }, + products: { + nationalExpress: false, + national: false, + regionalExp: false, + regional: false, + suburban: false, + bus: false, + ferry: false, + subway: false, + tram: false, + taxi: false + }, + transitAuthority: 'VBB', + }], transitAuthority: 'VBB', + entrances: [{ + type: 'location', id: '608011155', + latitude: 52.521814, longitude: 13.411456 + }, { + type: 'location', id: '718011155', + latitude: 52.521373, longitude: 13.413317 + }, { + type: 'location', id: '708011155', + latitude: 52.522317, longitude: 13.412895 + }, { + type: 'location', id: '698011155', + latitude: 52.520852, longitude: 13.412274 + }, { + type: 'location', id: '688011155', + latitude: 52.521176, longitude: 13.412463 + }, { + type: 'location', id: '678011155', + latitude: 52.520933, longitude: 13.41285 + }, { + type: 'location', id: '668011155', + latitude: 52.520798, longitude: 13.411717 + }, { + type: 'location', id: '658011155', + latitude: 52.52096, longitude: 13.414908 + }, { + type: 'location', id: '648011155', + latitude: 52.521724, longitude: 13.41027 + }, { + type: 'location', id: '638011155', + latitude: 52.52211, longitude: 13.410881 + }, { + type: 'location', id: '628011155', + latitude: 52.522119, longitude: 13.414647 + }, { + type: 'location', id: '618011155', + latitude: 52.521409, longitude: 13.410728 + }, { + type: 'location', id: '8089001', + latitude: 52.521643, longitude: 13.411097 + }, { + type: 'location', id: '608089001', + latitude: 52.521409, longitude: 13.410728 + }, { + type: 'location', id: '718089001', + latitude: 52.521373, longitude: 13.413317 + }, { + type: 'location', id: '708089001', + latitude: 52.522317, longitude: 13.412895 + }, { + type: 'location', id: '698089001', + latitude: 52.520852, longitude: 13.412274 + }, { + type: 'location', id: '688089001', + latitude: 52.521176, longitude: 13.412463 + }, { + type: 'location', id: '678089001', + latitude: 52.520933, longitude: 13.41285 + }, { + type: 'location', id: '668089001', + latitude: 52.520798, longitude: 13.411717 + }, { + type: 'location', id: '658089001', + latitude: 52.52096, longitude: 13.414908 + }, { + type: 'location', id: '648089001', + latitude: 52.521724, longitude: 13.41027 + }, { + type: 'location', id: '638089001', + latitude: 52.52211, longitude: 13.410881 + }, { + type: 'location', id: '628089001', + latitude: 52.522119, longitude: 13.414647 + }, { + type: 'location', id: '618089001', + latitude: 52.521814, longitude: 13.411456 + }, { + type: 'location', id: '600732533', + latitude: 52.520933, longitude: 13.41285 + }, { + type: 'location', id: '710732533', + latitude: 52.522317, longitude: 13.412895 + }, { + type: 'location', id: '700732533', + latitude: 52.520852, longitude: 13.412274 + }, { + type: 'location', id: '690732533', + latitude: 52.520798, longitude: 13.411717 + }, { + type: 'location', id: '680732533', + latitude: 52.52096, longitude: 13.414908 + }, { + type: 'location', id: '670732533', + latitude: 52.521724, longitude: 13.41027 + }, { + type: 'location', id: '660732533', + latitude: 52.52211, longitude: 13.410881 + }, { + type: 'location', id: '650732533', + latitude: 52.521409, longitude: 13.410728 + }, { + type: 'location', id: '640732533', + latitude: 52.521814, longitude: 13.411456 + }, { + type: 'location', id: '630732533', + latitude: 52.522119, longitude: 13.414647 + }, { + type: 'location', id: '620732533', + latitude: 52.521373, longitude: 13.413317 + }, { + type: 'location', id: '610732533', + latitude: 52.521176, longitude: 13.412463 + }, { + type: 'location', id: '600728660', + latitude: 52.521373, longitude: 13.413317 + }, { + type: 'location', id: '710728660', + latitude: 52.520852, longitude: 13.412274 + }, { + type: 'location', id: '700728660', + latitude: 52.521176, longitude: 13.412463 + }, { + type: 'location', id: '690728660', + latitude: 52.520933, longitude: 13.41285 + }, { + type: 'location', id: '680728660', + latitude: 52.520798, longitude: 13.411717 + }, { + type: 'location', id: '670728660', + latitude: 52.521724, longitude: 13.41027 + }, { + type: 'location', id: '660728660', + latitude: 52.52211, longitude: 13.410881 + }, { + type: 'location', id: '650728660', + latitude: 52.521409, longitude: 13.410728 + }, { + type: 'location', id: '640728660', + latitude: 52.521814, longitude: 13.411456 + }, { + type: 'location', id: '630728660', + latitude: 52.522317, longitude: 13.412895 + }, { + type: 'location', id: '620728660', + latitude: 52.522119, longitude: 13.414647 + }, { + type: 'location', id: '610728660', + latitude: 52.52096, longitude: 13.414908 + }, { + type: 'location', id: '600728659', + latitude: 52.522119, longitude: 13.414647 + }, { + type: 'location', id: '710728659', + latitude: 52.520852, longitude: 13.412274 + }, { + type: 'location', id: '700728659', + latitude: 52.521176, longitude: 13.412463 + }, { + type: 'location', id: '690728659', + latitude: 52.520933, longitude: 13.41285 + }, { + type: 'location', id: '680728659', + latitude: 52.520798, longitude: 13.411717 + }, { + type: 'location', id: '670728659', + latitude: 52.521724, longitude: 13.41027 + }, { + type: 'location', id: '660728659', + latitude: 52.52211, longitude: 13.410881 + }, { + type: 'location', id: '650728659', + latitude: 52.521409, longitude: 13.410728 + }, { + type: 'location', id: '640728659', + latitude: 52.521814, longitude: 13.411456 + }, { + type: 'location', id: '630728659', + latitude: 52.521373, longitude: 13.413317 + }, { + type: 'location', id: '620728659', + latitude: 52.52096, longitude: 13.414908 + }, { + type: 'location', id: '610728659', + latitude: 52.522317, longitude: 13.412895 + }], + facilities, + reisezentrumOpeningHours, } diff --git a/test/fixtures/sncb-stop.json b/test/fixtures/sncb-stop.json new file mode 100644 index 00000000..30585a5c --- /dev/null +++ b/test/fixtures/sncb-stop.json @@ -0,0 +1,260 @@ +{ + "common": { + "locL": [ + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 5 [De Lijn]@X=4421281@Y=51219106@U=80@L=209588@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 5 [De Lijn]", + "icoX": 0, + "extId": "209588", + "state": "F", + "crd": { + "x": 4421281, + "y": 51219106, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "mMastLocX": 1 + }, + { + "lid": "A=1@O=Anvers-Central / Antwerpen-Centraal@X=4421102@Y=51217200@U=80@L=8821006@", + "type": "S", + "name": "Anvers-Central / Antwerpen-Centraal", + "icoX": 3, + "extId": "8821006", + "state": "F", + "crd": { + "x": 4421102, + "y": 51217200, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "pRefL": [ + 0, + 1, + 2, + 3, + 4, + 5 + ] + }, + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 4 [De Lijn]@X=4420634@Y=51219259@U=80@L=223108@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 4 [De Lijn]", + "icoX": 0, + "extId": "223108", + "state": "F", + "crd": { + "x": 4420634, + "y": 51219259, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "mMastLocX": 1 + }, + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 6 [De Lijn]@X=4421722@Y=51218693@U=80@L=224334@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 6 [De Lijn]", + "icoX": 4, + "extId": "224334", + "state": "F", + "crd": { + "x": 4421722, + "y": 51218693, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "pRefL": [ + 6 + ], + "mMastLocX": 1 + }, + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 3 [De Lijn]@X=4420922@Y=51219007@U=80@L=224505@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 3 [De Lijn]", + "icoX": 4, + "extId": "224505", + "state": "F", + "crd": { + "x": 4420922, + "y": 51219007, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "pRefL": [ + 7, + 8 + ], + "mMastLocX": 1 + }, + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 2 [De Lijn]@X=4421308@Y=51218863@U=80@L=239284@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 2 [De Lijn]", + "icoX": 4, + "extId": "239284", + "state": "F", + "crd": { + "x": 4421308, + "y": 51218863, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "pRefL": [ + 7, + 8 + ], + "mMastLocX": 1 + } + ], + "prodL": [ + { + "name": "THALYS", + "icoX": 1, + "cls": 1 + }, + { + "name": "S1", + "icoX": 2, + "cls": 16 + }, + { + "name": "S32", + "icoX": 2, + "cls": 16 + }, + { + "name": "S33", + "icoX": 2, + "cls": 16 + }, + { + "name": "S34", + "icoX": 2, + "cls": 16 + }, + { + "name": "S53", + "icoX": 2, + "cls": 16 + }, + { + "name": "Tra 12", + "nameS": "12", + "icoX": 4, + "cls": 1024, + "prodCtx": { + "lineId": "12" + } + }, + { + "name": "Tra 11", + "nameS": "11", + "icoX": 4, + "cls": 1024, + "prodCtx": { + "lineId": "11" + } + }, + { + "name": "Tra 24", + "nameS": "24", + "icoX": 4, + "cls": 1024, + "prodCtx": { + "lineId": "24" + } + } + ], + "polyL": [], + "layerL": [ + { + "id": "standard", + "name": "standard", + "index": 0, + "annoCnt": 0 + } + ], + "crdSysL": [ + { + "id": "standard", + "index": 0, + "type": "WGS84", + "dim": 2 + } + ], + "opL": [], + "remL": [], + "icoL": [ + { + "res": "STA" + }, + { + "res": "prod_ice" + }, + { + "res": "S", + "fg": { + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "bg": { + "r": 255, + "g": 175, + "b": 50, + "a": 255 + } + }, + { + "res": "STA_SNCB" + }, + { + "res": "prod_tram" + } + ] + }, + "locL": [ + { + "lid": "A=1@O=Antwerpen Centraal Station Perron 1 [De Lijn]@X=4421263@Y=51218818@U=80@L=232853@", + "type": "S", + "name": "Antwerpen Centraal Station Perron 1 [De Lijn]", + "icoX": 0, + "extId": "232853", + "state": "F", + "crd": { + "x": 4421263, + "y": 51218818, + "type": "WGS84", + "layerX": 0, + "crdSysX": 0 + }, + "pCls": 1653, + "stopLocL": [ + 0, + 2, + 3, + 4, + 5, + 1 + ], + "mMastLocX": 1 + } + ] +} \ No newline at end of file