mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
add öbb via tests
This commit is contained in:
parent
2506e4c495
commit
cd63078b83
1 changed files with 37 additions and 9 deletions
46
test/oebb.js
46
test/oebb.js
|
@ -257,19 +257,47 @@ test('Albertina to Salzburg Hbf', co(function* (t) {
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
test('Wien to Klagenfurt Hbf with stopover at Salzburg Hbf', co(function* (t) {
|
test('journeys: via works – with detour', co(function* (t) {
|
||||||
const [journey] = yield client.journeys(wien, klagenfurtHbf, {
|
// Going from Stephansplatz to Schottenring via Donauinsel without detour
|
||||||
via: salzburgHbf,
|
// is currently impossible
|
||||||
|
const stephansplatz = '001390167'
|
||||||
|
const schottenring = '001390163'
|
||||||
|
const donauinsel = '001392277'
|
||||||
|
const donauinselPassed = '922001'
|
||||||
|
const [journey] = yield client.journeys(stephansplatz, schottenring, {
|
||||||
|
via: donauinsel,
|
||||||
results: 1,
|
results: 1,
|
||||||
when
|
when,
|
||||||
|
passedStations: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const i1 = journey.legs.findIndex(leg => leg.destination.id === salzburgHbf)
|
t.ok(journey)
|
||||||
t.ok(i1 >= 0, 'no leg with Salzburg Hbf as destination')
|
|
||||||
|
|
||||||
const i2 = journey.legs.findIndex(leg => leg.origin.id === salzburgHbf)
|
const l = journey.legs.some(l => l.passed && l.passed.some(p => p.station.id === donauinselPassed))
|
||||||
t.ok(i2 >= 0, 'no leg with Salzburg Hbf as origin')
|
t.ok(l, 'no stopover at Donauinsel')
|
||||||
t.ok(i2 > i1, 'leg with Salzburg Hbf as origin must be after leg to it')
|
|
||||||
|
t.end()
|
||||||
|
}))
|
||||||
|
|
||||||
|
test('journeys: via works – without detour', co(function* (t) {
|
||||||
|
// When going from Karlsplatz to Praterstern via Museumsquartier, there is *no need*
|
||||||
|
// to change trains / no need for a "detour".
|
||||||
|
const karlsplatz = '001390461'
|
||||||
|
const praterstern = '001290201'
|
||||||
|
const museumsquartier = '001390171'
|
||||||
|
const museumsquartierPassed = '901014'
|
||||||
|
|
||||||
|
const [journey] = yield client.journeys(karlsplatz, praterstern, {
|
||||||
|
via: museumsquartier,
|
||||||
|
results: 1,
|
||||||
|
when,
|
||||||
|
passedStations: true
|
||||||
|
})
|
||||||
|
|
||||||
|
t.ok(journey)
|
||||||
|
|
||||||
|
const l = journey.legs.some(l => l.passed && l.passed.some(p => p.station.id === museumsquartierPassed))
|
||||||
|
t.ok(l, 'no stopover at Weihburggasse')
|
||||||
|
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Reference in a new issue