2018-04-23 13:56:00 +02:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const co = require('./co')
|
|
|
|
|
|
|
|
const testJourneysStationToStation = co(function* (cfg) {
|
|
|
|
const {test: t, journeys, validate, fromId, toId} = cfg
|
|
|
|
|
|
|
|
validate(t, journeys, 'journeys', 'journeys')
|
|
|
|
t.strictEqual(journeys.length, 3)
|
|
|
|
for (let i = 0; i < journeys.length; i++) {
|
|
|
|
const j = journeys[i]
|
|
|
|
|
2018-07-11 13:25:22 +02:00
|
|
|
let origin = j.legs[0].origin
|
|
|
|
if (origin.station) origin = origin.station
|
|
|
|
let dest = j.legs[j.legs.length - 1].destination
|
|
|
|
if (dest.station) dest = dest.station
|
|
|
|
t.strictEqual(origin.id, fromId)
|
|
|
|
t.strictEqual(dest.id, toId)
|
2018-04-23 13:56:00 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = testJourneysStationToStation
|