From 9257d3ad7d09624fc2906e8c205996a60a88fcf5 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 22 Aug 2018 19:02:56 +0200 Subject: [PATCH] parse line.fahrtNr, adapt tests :white_check_mark:, adapt docs :memo: --- docs/departures.md | 3 +++ docs/journeys.md | 1 + docs/radar.md | 2 ++ docs/trip.md | 1 + parse/line.js | 1 + test/lib/validators.js | 4 ++++ 6 files changed, 12 insertions(+) diff --git a/docs/departures.md b/docs/departures.md index a7680a73..71ecf46d 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -86,6 +86,7 @@ The response may look like this: line: { type: 'line', id: '18299', + fahrtNr: '12345', mode: 'train', product: 'suburban', public: true, @@ -113,6 +114,7 @@ The response may look like this: line: { type: 'line', id: '16441', + fahrtNr: '54321', mode: 'train', product: 'suburban', public: true, @@ -137,6 +139,7 @@ The response may look like this: line: { type: 'line', id: '19494', + fahrtNr: '11111', mode: 'train', product: 'subway', public: true, diff --git a/docs/journeys.md b/docs/journeys.md index 3242eb23..59efe021 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -139,6 +139,7 @@ The response may look like this: line: { type: 'line', id: '16845', + fahrtNr: '12345', name: 'S7', public: true, mode: 'train', diff --git a/docs/radar.md b/docs/radar.md index 308f6dce..3b5f8bcc 100644 --- a/docs/radar.md +++ b/docs/radar.md @@ -50,6 +50,7 @@ The response may look like this: line: { type: 'line', id: 's9', + fahrtNr: '12345', name: 'S9', public: true, mode: 'train', @@ -122,6 +123,7 @@ The response may look like this: line: { type: 'line', id: 'm2', + fahrtNr: '54321', name: 'M2', public: true, mode: 'train', diff --git a/docs/trip.md b/docs/trip.md index b4f0976e..658f006a 100644 --- a/docs/trip.md +++ b/docs/trip.md @@ -101,6 +101,7 @@ The response looked like this: line: { type: 'line', id: '18299', + fahrtNr: '12345', name: 'S9', public: true, mode: 'train', diff --git a/parse/line.js b/parse/line.js index 716bb69a..c9d2710f 100644 --- a/parse/line.js +++ b/parse/line.js @@ -15,6 +15,7 @@ const createParseLine = (profile, opt, {operators}) => { const res = { type: 'line', id: null, + fahrtNr: p.prodCtx && p.prodCtx.num || null, name: p.line || p.name, public: true } diff --git a/test/lib/validators.js b/test/lib/validators.js index 985598fd..9aa8365f 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -82,6 +82,10 @@ const createValidateLine = (cfg) => { const validateLine = (val, line, name = 'line') => { defaultValidators.line(val, line, name) + + a.strictEqual(typeof line.fahrtNr, 'string', name + ' must be string') + a.ok(line.fahrtNr, name + ' must not be empty') + a.ok(validLineModes.includes(line.mode), name + '.mode is invalid') } return validateLine