mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
journeys: add journey.type 🐛
To make it FPTF-compliant.
This commit is contained in:
parent
b1441d8be6
commit
d3551d2e51
4 changed files with 7 additions and 0 deletions
|
@ -14,6 +14,7 @@ const createParseJourney = (profile, stations, lines, remarks) => {
|
||||||
const parseJourney = (j) => {
|
const parseJourney = (j) => {
|
||||||
const legs = j.secL.map(leg => parseLeg(j, leg))
|
const legs = j.secL.map(leg => parseLeg(j, leg))
|
||||||
const res = {
|
const res = {
|
||||||
|
type: 'journey',
|
||||||
legs,
|
legs,
|
||||||
origin: legs[0].origin,
|
origin: legs[0].origin,
|
||||||
destination: legs[legs.length - 1].destination,
|
destination: legs[legs.length - 1].destination,
|
||||||
|
|
|
@ -100,6 +100,8 @@ test('Berlin Jungfernheide to München Hbf', co(function* (t) {
|
||||||
t.ok(Array.isArray(journeys))
|
t.ok(Array.isArray(journeys))
|
||||||
t.ok(journeys.length > 0, 'no journeys')
|
t.ok(journeys.length > 0, 'no journeys')
|
||||||
for (let journey of journeys) {
|
for (let journey of journeys) {
|
||||||
|
t.equal(journey.type, 'journey')
|
||||||
|
|
||||||
assertValidStation(t, journey.origin)
|
assertValidStation(t, journey.origin)
|
||||||
assertValidStationProducts(t, journey.origin.products)
|
assertValidStationProducts(t, journey.origin.products)
|
||||||
if (!(yield findStation(journey.origin.id))) {
|
if (!(yield findStation(journey.origin.id))) {
|
||||||
|
|
|
@ -120,6 +120,8 @@ test('Salzburg Hbf to Wien Westbahnhof', co(function* (t) {
|
||||||
t.ok(Array.isArray(journeys))
|
t.ok(Array.isArray(journeys))
|
||||||
t.ok(journeys.length > 0, 'no journeys')
|
t.ok(journeys.length > 0, 'no journeys')
|
||||||
for (let journey of journeys) {
|
for (let journey of journeys) {
|
||||||
|
t.equal(journey.type, 'journey')
|
||||||
|
|
||||||
assertValidStation(t, journey.origin)
|
assertValidStation(t, journey.origin)
|
||||||
assertValidStationProducts(t, journey.origin.products)
|
assertValidStationProducts(t, journey.origin.products)
|
||||||
// todo
|
// todo
|
||||||
|
|
|
@ -67,6 +67,8 @@ test('journeys – station to station', co(function* (t) {
|
||||||
t.strictEqual(journeys.length, 3)
|
t.strictEqual(journeys.length, 3)
|
||||||
|
|
||||||
for (let journey of journeys) {
|
for (let journey of journeys) {
|
||||||
|
t.equal(journey.type, 'journey')
|
||||||
|
|
||||||
assertValidStation(t, journey.origin)
|
assertValidStation(t, journey.origin)
|
||||||
assertValidStationProducts(t, journey.origin.products)
|
assertValidStationProducts(t, journey.origin.products)
|
||||||
t.ok(journey.origin.name.indexOf('(Berlin)') === -1)
|
t.ok(journey.origin.name.indexOf('(Berlin)') === -1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue