adapt docs & tests to 0e1fcb0 📝

This commit is contained in:
Jannis R 2019-02-01 14:55:01 +01:00
parent 0e1fcb0c99
commit c1bb9a6a5c
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 9 additions and 7 deletions

View file

@ -222,8 +222,8 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou
},
departure: '2018-07-11T00:01:00.000+02:00',
arrival: '2018-07-11T00:10:00.000+02:00',
mode: 'walking',
public: true,
walking: true,
distance: 558
} ]
} ],

View file

@ -124,8 +124,8 @@ The returned [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript
products: { /* … */ }
},
arrival: '2017-12-17T17:33:00.000+01:00',
mode: 'walking',
public: true
public: true,
walking: true
}, {
id: '1|70906|0|81|17122017',
origin: {

View file

@ -221,7 +221,11 @@ const createValidateJourneyLeg = (cfg) => {
}
}
if (leg.mode === 'walking') {
// todo: leg.public
if ('walking' in leg) {
a.strictEqual(typeof leg.walking, 'boolean', name + '.walking must be a boolean')
}
if (leg.walking) {
if (leg.distance !== null) {
const msg = name + '.distance must be '
a.strictEqual(typeof leg.distance, 'number', msg + 'a number')

View file

@ -61,9 +61,7 @@ const validateLine = (validate, l, name) => {
const _validateJourneyLeg = createValidateJourneyLeg(cfg)
const validateJourneyLeg = (validate, l, name) => {
_validateJourneyLeg(validate, l, name)
if (l.mode !== 'walking') {
validateDirection(l.direction, name + '.direction')
}
if (!l.walking) validateDirection(l.direction, name + '.direction')
}
const _validateDeparture = createValidateDeparture(cfg)