diff --git a/docs/journey-leg.md b/docs/journey-leg.md index e21293c7..e98f93f5 100644 --- a/docs/journey-leg.md +++ b/docs/journey-leg.md @@ -114,7 +114,7 @@ The response looked like this: } }, direction: 'S Spandau', - passed: [ /* … */ ] + stopovers: [ /* … */ ] } ``` diff --git a/docs/journeys.md b/docs/journeys.md index b566edb3..f104bd88 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -159,7 +159,7 @@ The response may look like this: } }, direction: 'S Potsdam Hauptbahnhof', - passed: [ { + stopovers: [ { station: { type: 'station', id: '900000003201', diff --git a/parse/journey-leg.js b/parse/journey-leg.js index 331f0c36..45038d02 100644 --- a/parse/journey-leg.js +++ b/parse/journey-leg.js @@ -58,9 +58,9 @@ const createParseJourneyLeg = (profile, stations, lines, remarks, polylines) => if (passed && pt.jny.stopL) { const parse = profile.parseStopover(profile, stations, lines, remarks, j.date) - const passedStations = pt.jny.stopL.map(parse) + const stopovers = pt.jny.stopL.map(parse) // filter stations the train passes without stopping, as this doesn't comply with fptf (yet) - res.passed = passedStations.filter((x) => !x.passBy) + res.stopovers = stopovers.filter((x) => !x.passBy) } if (Array.isArray(pt.jny.remL)) { for (let remark of pt.jny.remL) applyRemark(j, remark) diff --git a/test/lib/journeys-with-detour.js b/test/lib/journeys-with-detour.js index 2358a898..0e454f3a 100644 --- a/test/lib/journeys-with-detour.js +++ b/test/lib/journeys-with-detour.js @@ -11,8 +11,8 @@ const testJourneysWithDetour = co(function* (cfg) { validate(t, journeys, 'journeys', 'journeys') const leg = journeys[0].legs.some((leg) => { - return leg.passed && leg.passed.some((passed) => { - return detourIds.includes(passed.station.id) + return leg.stopovers && leg.stopovers.some((stopover) => { + return detourIds.includes(stopover.station.id) }) }) t.ok(leg, detourIds.join('/') + ' is not being passed') diff --git a/test/lib/validators.js b/test/lib/validators.js index 88ddcc9c..3fd6ec6b 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -171,12 +171,12 @@ const createValidateJourneyLeg = (cfg) => { a.ok(leg.departurePlatform, name + '.departurePlatform must not be empty') } - if ('passed' in leg) { - a.ok(Array.isArray(leg.passed), name + '.passed must be an array') - a.ok(leg.passed.length > 0, name + '.passed must not be empty') + if ('stopovers' in leg) { + a.ok(Array.isArray(leg.stopovers), name + '.stopovers must be an array') + a.ok(leg.stopovers.length > 0, name + '.stopovers must not be empty') - for (let i = 0; i < leg.passed.length; i++) { - val.stopover(val, leg.passed[i], name + `.passed[${i}]`) + for (let i = 0; i < leg.stopovers.length; i++) { + val.stopover(val, leg.stopovers[i], name + `.stopovers[${i}]`) } } diff --git a/test/nahsh.js b/test/nahsh.js index ab82635b..0e1d88a4 100644 --- a/test/nahsh.js +++ b/test/nahsh.js @@ -159,8 +159,8 @@ test('Husum to Lübeck Hbf with stopover at Kiel Hbf', co(function* (t) { validate(t, journeys, 'journeys', 'journeys') const leg = journeys[0].legs.some((leg) => { - return leg.passed && leg.passed.some((passed) => { - return passed.station.id === kielHbf + return leg.stopovers && leg.stopovers.some((stopover) => { + return stopover.station.id === kielHbf }) }) t.ok(leg, 'Kiel Hbf is not being passed') diff --git a/test/oebb.js b/test/oebb.js index c88c85e5..169aba61 100644 --- a/test/oebb.js +++ b/test/oebb.js @@ -188,8 +188,8 @@ test('journeys: via works – without detour', co(function* (t) { t.notOk(l1, 'transfer at Museumsquartier') const l2 = journeys[0].legs.some((leg) => { - return leg.passed && leg.passed.some((passed) => { - return passed.station.id === museumsquartierPassed + return leg.stopovers && leg.stopovers.some((stopover) => { + return stopover.station.id === museumsquartierPassed }) }) t.ok(l2, 'Museumsquartier is not being passed')