fix ÖBB tests 💚

This commit is contained in:
Jannis R 2018-01-23 01:30:20 +01:00
parent a28ead4cc1
commit 0ee53ff624
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 6 additions and 6 deletions

View file

@ -4,9 +4,9 @@ let captureStackTrace = () => {}
if (process.env.NODE_ENV === 'dev') { if (process.env.NODE_ENV === 'dev') {
captureStackTrace = require('capture-stack-trace') captureStackTrace = require('capture-stack-trace')
} }
const {stringify} = require('query-string')
const Promise = require('pinkie-promise') const Promise = require('pinkie-promise')
const {fetch} = require('fetch-ponyfill')({Promise}) const {fetch} = require('fetch-ponyfill')({Promise})
const {stringify} = require('query-string')
const request = (profile, data) => { const request = (profile, data) => {
const body = profile.transformReqBody({lang: 'en', svcReqL: [data]}) const body = profile.transformReqBody({lang: 'en', svcReqL: [data]})

View file

@ -261,12 +261,12 @@ test('Wien to Klagenfurt Hbf with stopover at Salzburg Hbf', co.wrap(function* (
results: 1 results: 1
}) })
const i = journey.legs.findIndex(leg => leg.destination.id === salzburgHbf) const i1 = journey.legs.findIndex(leg => leg.destination.id === salzburgHbf)
t.ok(i >= 0, 'no leg with Hannover Hbf as destination') t.ok(i1 >= 0, 'no leg with Salzburg Hbf as destination')
const nextLeg = journey.legs[i + 1] const i2 = journey.legs.findIndex(leg => leg.origin.id === salzburgHbf)
t.ok(nextLeg) t.ok(i2 >= 0, 'no leg with Salzburg Hbf as origin')
t.equal(nextLeg.origin.id, salzburgHbf) t.ok(i2 > i1, 'leg with Salzburg Hbf as origin must be after leg to it')
t.end() t.end()
})) }))