diff --git a/lib/request.js b/lib/request.js index 5190a912..1aefd2b4 100644 --- a/lib/request.js +++ b/lib/request.js @@ -4,9 +4,9 @@ let captureStackTrace = () => {} if (process.env.NODE_ENV === 'dev') { captureStackTrace = require('capture-stack-trace') } +const {stringify} = require('query-string') const Promise = require('pinkie-promise') const {fetch} = require('fetch-ponyfill')({Promise}) -const {stringify} = require('query-string') const request = (profile, data) => { const body = profile.transformReqBody({lang: 'en', svcReqL: [data]}) diff --git a/test/oebb.js b/test/oebb.js index 787eae15..7c9ba9a4 100644 --- a/test/oebb.js +++ b/test/oebb.js @@ -261,12 +261,12 @@ test('Wien to Klagenfurt Hbf with stopover at Salzburg Hbf', co.wrap(function* ( results: 1 }) - const i = journey.legs.findIndex(leg => leg.destination.id === salzburgHbf) - t.ok(i >= 0, 'no leg with Hannover Hbf as destination') + const i1 = journey.legs.findIndex(leg => leg.destination.id === salzburgHbf) + t.ok(i1 >= 0, 'no leg with Salzburg Hbf as destination') - const nextLeg = journey.legs[i + 1] - t.ok(nextLeg) - t.equal(nextLeg.origin.id, salzburgHbf) + const i2 = journey.legs.findIndex(leg => leg.origin.id === salzburgHbf) + t.ok(i2 >= 0, 'no leg with Salzburg Hbf as origin') + t.ok(i2 > i1, 'leg with Salzburg Hbf as origin must be after leg to it') t.end() }))