diff --git a/p/nahsh/index.js b/p/nahsh/index.js index 9a992266..fd5ea3ae 100644 --- a/p/nahsh/index.js +++ b/p/nahsh/index.js @@ -84,7 +84,7 @@ const createParseMovement = (profile, opt, data) => { const res = _parseMovement(m) // filter out empty nextStops entries res.nextStops = res.nextStops.filter((f) => { - return f.station !== null || f.arrival !== null || f.departure !== null + return f.stop !== null || f.arrival !== null || f.departure !== null }) return res } diff --git a/test/lib/arrivals.js b/test/lib/arrivals.js index 4a21771e..4c486f49 100644 --- a/test/lib/arrivals.js +++ b/test/lib/arrivals.js @@ -8,14 +8,14 @@ const testArrivals = co(function* (cfg) { validate(t, arrs, 'arrivals', 'arrivals') t.ok(arrs.length > 0, 'must be >0 arrivals') for (let i = 0; i < arrs.length; i++) { - let station = arrs[i].station - let name = `arrs[${i}].station` - if (station.station) { - station = station.station + let stop = arrs[i].stop + let name = `arrs[${i}].stop` + if (stop.station) { + stop = stop.station name += '.station' } - t.equal(station.id, id, name + '.id is invalid') + t.equal(stop.id, id, name + '.id is invalid') } // todo: move into arrivals validator diff --git a/test/lib/departures.js b/test/lib/departures.js index f73015fc..e0853fe1 100644 --- a/test/lib/departures.js +++ b/test/lib/departures.js @@ -8,14 +8,14 @@ const testDepartures = co(function* (cfg) { validate(t, deps, 'departures', 'departures') t.ok(deps.length > 0, 'must be >0 departures') for (let i = 0; i < deps.length; i++) { - let station = deps[i].station - let name = `deps[${i}].station` - if (station.station) { - station = station.station + let stop = deps[i].stop + let name = `deps[${i}].stop` + if (stop.station) { + stop = stop.station name += '.station' } - t.equal(station.id, id, name + '.id is invalid') + t.equal(stop.id, id, name + '.id is invalid') } // todo: move into deps validator diff --git a/test/lib/journeys-station-to-address.js b/test/lib/journeys-station-to-address.js index f7e9f9fb..1184aeda 100644 --- a/test/lib/journeys-station-to-address.js +++ b/test/lib/journeys-station-to-address.js @@ -14,7 +14,8 @@ const testJourneysStationToAddress = co(function* (cfg) { const j = journeys[i] const firstLeg = j.legs[0] - t.strictEqual(firstLeg.origin.id, fromId) + const orig = firstLeg.origin.station || firstLeg.origin + t.ok(orig.id, fromId) const d = j.legs[j.legs.length - 1].destination const n = `journeys[0].legs[${i}].destination` diff --git a/test/lib/validators.js b/test/lib/validators.js index 3a91d28f..985598fd 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -262,7 +262,7 @@ const createValidateArrivalOrDeparture = (cfg) => { a.ok(dep.tripId, name + '.tripId must not be empty') a.strictEqual(typeof dep.trip, 'number', name + '.trip must be a number') - anyOf(['stop', 'station'], val, dep.station, name + '.station') + anyOf(['stop', 'station'], val, dep.stop, name + '.stop') assertValidWhen(dep.when, cfg.when, name) if (dep.delay !== null) { diff --git a/test/oebb.js b/test/oebb.js index dc1c96ae..3c8474a8 100644 --- a/test/oebb.js +++ b/test/oebb.js @@ -246,8 +246,8 @@ test('departures at Wien Leibenfrostgasse', co(function* (t) { for (let i = 0; i < deps.length; i++) { const dep = deps[i] - const msg = `deps[${i}].station.id is invalid` - t.ok(ids.includes(dep.station.id, msg)) + const msg = `deps[${i}].stop.id is invalid` + t.ok(ids.includes(dep.stop.id, msg)) } t.end()