journeys: add test for opt.arrival

This commit is contained in:
Jannis R 2018-05-28 21:09:11 +02:00 committed by Jannis Redmann
parent a59b340d67
commit 0169e83731

View file

@ -158,6 +158,23 @@ test('journeys  fails with no product', co(function* (t) {
} }
})) }))
test('journeys before date/time', co(function* (t) {
const journeys = yield client.journeys(spichernstr, bismarckstr, {
results: 3, arrival: when
})
for (let i = 0; i < journeys.length; i++) {
const j = journeys[i]
const name = `journeys[${i}]`
const lastLeg = j.legs[j.legs.length - 1]
const arr = +new Date(lastLeg.arrival)
t.ok(arr <= when, name + '.arrival is after `when`')
}
t.end()
}))
test('earlier/later journeys', co(function* (t) { test('earlier/later journeys', co(function* (t) {
const model = yield client.journeys(spichernstr, bismarckstr, { const model = yield client.journeys(spichernstr, bismarckstr, {
results: 3, departure: when results: 3, departure: when