mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
journeys: add test for opt.arrival
This commit is contained in:
parent
a59b340d67
commit
0169e83731
1 changed files with 17 additions and 0 deletions
17
test/vbb.js
17
test/vbb.js
|
@ -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) {
|
||||
const model = yield client.journeys(spichernstr, bismarckstr, {
|
||||
results: 3, departure: when
|
||||
|
|
Loading…
Add table
Reference in a new issue