db-vendo-client/test/lib/journeys-with-detour.js
Jannis R 6611f262bf leg.passed -> leg.stopovers 💥
Some didn't unterstand what "passed" means in this context.
"stopovers" is a lot less ambiguous; Also, it aligns with
`parseStopover` and FPTF.
2018-06-19 08:23:49 +02:00

21 lines
604 B
JavaScript

'use strict'
const co = require('./co')
const testJourneysWithDetour = co(function* (cfg) {
const {test: t, journeys, validate, detourIds} = cfg
// We assume that going from A to B via C *without* detour is currently
// impossible. We check if the routing engine computes a detour.
validate(t, journeys, 'journeys', 'journeys')
const leg = journeys[0].legs.some((leg) => {
return leg.stopovers && leg.stopovers.some((stopover) => {
return detourIds.includes(stopover.station.id)
})
})
t.ok(leg, detourIds.join('/') + ' is not being passed')
})
module.exports = testJourneysWithDetour