mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
update insa via tests
This commit is contained in:
parent
59ec6a83d5
commit
06cc37b45f
1 changed files with 37 additions and 12 deletions
49
test/insa.js
49
test/insa.js
|
@ -189,22 +189,47 @@ test('Kloster Unser Lieben Frauen to Magdeburg Hbf', co(function*(t) {
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
test('Magdeburg-Buckau to Magdeburg-Neustadt with stopover at Magdeburg Hbf', co(function*(t) {
|
test('journeys: via works – with detour', co(function* (t) {
|
||||||
const magdeburgBuckau = '8013456'
|
// Going from Magdeburg, Hasselbachplatz (Sternstr.) (Tram/Bus) to Stendal via Dessau without detour
|
||||||
const magdeburgNeustadt = '8010226'
|
// is currently impossible. We check if the routing engine computes a detour.
|
||||||
const magdeburgHbf = '8010224'
|
const hasselbachplatzSternstrasse = '000006545'
|
||||||
const [journey] = yield client.journeys(magdeburgBuckau, magdeburgNeustadt, {
|
const stendal = '008010334'
|
||||||
via: magdeburgHbf,
|
const dessau = '008010077'
|
||||||
|
const dessauPassed = '8010077'
|
||||||
|
const [journey] = yield client.journeys(hasselbachplatzSternstrasse, stendal, {
|
||||||
|
via: dessau,
|
||||||
results: 1,
|
results: 1,
|
||||||
when
|
when,
|
||||||
|
passedStations: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const i1 = journey.legs.findIndex(leg => leg.destination.id === magdeburgHbf)
|
t.ok(journey)
|
||||||
t.ok(i1 >= 0, 'no leg with Magdeburg Hbf as destination')
|
|
||||||
|
|
||||||
const i2 = journey.legs.findIndex(leg => leg.origin.id === magdeburgHbf)
|
const l = journey.legs.some(l => l.passed && l.passed.some(p => p.station.id === dessauPassed))
|
||||||
t.ok(i2 >= 0, 'no leg with Magdeburg Hbf as origin')
|
t.ok(l, 'Dessau is not being passed')
|
||||||
t.ok(i2 > i1, 'leg with Magdeburg Hbf as origin must be after leg to it')
|
|
||||||
|
t.end()
|
||||||
|
}))
|
||||||
|
|
||||||
|
test('journeys: via works – without detour', co(function* (t) {
|
||||||
|
// When going from Magdeburg, Hasselbachplatz (Sternstr.) (Tram/Bus) to Magdeburg, Universität via Magdeburg, Breiter Weg, there is *no need*
|
||||||
|
// to change trains / no need for a "detour".
|
||||||
|
const hasselbachplatzSternstrasse = '000006545'
|
||||||
|
const universitaet = '000019686'
|
||||||
|
const breiterWeg = '000013519'
|
||||||
|
const breiterWegPassed = '13519'
|
||||||
|
|
||||||
|
const [journey] = yield client.journeys(hasselbachplatzSternstrasse, universitaet, {
|
||||||
|
via: breiterWeg,
|
||||||
|
results: 1,
|
||||||
|
when,
|
||||||
|
passedStations: true
|
||||||
|
})
|
||||||
|
|
||||||
|
t.ok(journey)
|
||||||
|
|
||||||
|
const l = journey.legs.some(l => l.passed && l.passed.some(p => p.station.id === breiterWegPassed))
|
||||||
|
t.ok(l, 'Magdeburg, Breiter Weg is not being passed')
|
||||||
|
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Reference in a new issue