From c1bb9a6a5c250ba6b2d32a7bd08d6cce2b51c169 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Fri, 1 Feb 2019 14:55:01 +0100 Subject: [PATCH] adapt docs & tests to 0e1fcb0 :memo: :white_check_mark: --- docs/journeys.md | 2 +- readme.md | 4 ++-- test/lib/validators.js | 6 +++++- test/lib/vbb-bvg-validators.js | 4 +--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/journeys.md b/docs/journeys.md index 5824e7fb..febbe95f 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -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 } ] } ], diff --git a/readme.md b/readme.md index 5cdf43b9..a02ec9fe 100644 --- a/readme.md +++ b/readme.md @@ -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: { diff --git a/test/lib/validators.js b/test/lib/validators.js index 9f0510a1..56b4440b 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -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') diff --git a/test/lib/vbb-bvg-validators.js b/test/lib/vbb-bvg-validators.js index 82c2ea1c..ddab067b 100644 --- a/test/lib/vbb-bvg-validators.js +++ b/test/lib/vbb-bvg-validators.js @@ -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)