From e0cdd55908fad79d8ead97c73f8601fd3f68c90f Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 29 Dec 2021 17:00:14 +0100 Subject: [PATCH] =?UTF-8?q?parseWarning:=20{from,to}Loc=20->=20{from,to}Lo?= =?UTF-8?q?cation=20=F0=9F=92=A5=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parse/warning.js | 10 ++++------ test/db-netz-remarks.js | 8 ++++---- test/fixtures/oebb-trip.js | 4 ++-- test/fixtures/vsn-remarks.js | 32 ++++++++++++++++---------------- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/parse/warning.js b/parse/warning.js index 787dcf32..810ab672 100644 --- a/parse/warning.js +++ b/parse/warning.js @@ -14,17 +14,15 @@ const parseMsgEdge = (ctx) => (e) => { 'tLocX', 'toLocation' ]) res.icon = e.icon || null - // todo: rename `Loc` -> `Location` [breaking] - res.fromLoc = Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null - res.toLoc = Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null + res.fromLocation = Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null + res.toLocation = Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null return res } const parseMsgEvent = (ctx) => (e) => { const {profile} = ctx // todo: test that covers this return { - // todo: rename `Loc` -> `Location` [breaking] - fromLoc: Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null, - toLoc: Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null, + fromLocation: Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null, + toLocation: Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null, start: profile.parseDateTime(ctx, e.fDate, e.fTime, null), end: profile.parseDateTime(ctx, e.tDate, e.tTime, null), sections: e.sectionNums || [] // todo: parse diff --git a/test/db-netz-remarks.js b/test/db-netz-remarks.js index 2f8a166f..6a350bf3 100644 --- a/test/db-netz-remarks.js +++ b/test/db-netz-remarks.js @@ -40,7 +40,7 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => { icoCrd: { x: 13469131, y: 52614672, type: 'WGS84' }, msgRefL: [ 3, 7, 17, 18, 20, 21 ], icon: { type: 'HIM11216', title: null }, - fromLoc: { + fromLocation: { type: 'stop', id: '8011046', name: 'Berlin-Karow (BKAR)', @@ -52,7 +52,7 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => { }, products: { a: true, b: false, c: true } }, - toLoc: { + toLocation: { type: 'stop', id: '8011046', name: 'Berlin-Karow (BKAR)', @@ -66,7 +66,7 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => { } }], events: [{ - fromLoc: { + fromLocation: { type: 'stop', id: '8011046', name: 'Berlin-Karow (BKAR)', @@ -78,7 +78,7 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => { }, products: { a: true, b: false, c: true } }, - toLoc: { + toLocation: { type: 'stop', id: '8011046', name: 'Berlin-Karow (BKAR)', diff --git a/test/fixtures/oebb-trip.js b/test/fixtures/oebb-trip.js index caa63186..4e781201 100644 --- a/test/fixtures/oebb-trip.js +++ b/test/fixtures/oebb-trip.js @@ -88,8 +88,8 @@ const corona = { edges: [{ icoCrd: {x: 14768356, y: 48156724, type: 'WGS84'}, icon: null, - fromLoc: null, - toLoc: null + fromLocation: null, + toLocation: null }], validFrom: '2020-05-15T00:00:00+02:00', validUntil: '2020-06-30T23:59:00+02:00', diff --git a/test/fixtures/vsn-remarks.js b/test/fixtures/vsn-remarks.js index 1943a5cb..669f8081 100644 --- a/test/fixtures/vsn-remarks.js +++ b/test/fixtures/vsn-remarks.js @@ -26,14 +26,14 @@ module.exports = [ { icoCrd: { x: 7875575, y: 52201492 }, icon: null, - fromLoc: null, - toLoc: null + fromLocation: null, + toLocation: null } ], events: [ { - fromLoc: null, - toLoc: null, + fromLocation: null, + toLocation: null, start: '2020-02-03T11:11:00+01:00', end: '2020-12-13T00:00:00+01:00', sections: [] @@ -79,14 +79,14 @@ module.exports = [ { icoCrd: { x: 9395422, y: 51748714 }, icon: null, - fromLoc: null, - toLoc: null + fromLocation: null, + toLocation: null } ], events: [ { - fromLoc: null, - toLoc: null, + fromLocation: null, + toLocation: null, start: '2019-12-15T00:00:00+01:00', end: '2020-12-12T23:59:00+01:00', sections: [] @@ -139,14 +139,14 @@ module.exports = [ { icoCrd: { x: 9435051, y: 51783147 }, icon: null, - fromLoc: null, - toLoc: null + fromLocation: null, + toLocation: null } ], events: [ { - fromLoc: null, - toLoc: null, + fromLocation: null, + toLocation: null, start: '2019-12-15T00:00:00+01:00', end: '2020-12-12T23:59:00+01:00', sections: [] @@ -213,8 +213,8 @@ module.exports = [ categories: [ 0 ], events: [ { - fromLoc: null, - toLoc: null, + fromLocation: null, + toLocation: null, start: '2020-02-21T11:31:00+01:00', end: '2020-06-30T23:59:00+02:00', sections: [] @@ -288,8 +288,8 @@ module.exports = [ categories: [ 0 ], events: [ { - fromLoc: null, - toLoc: null, + fromLocation: null, + toLocation: null, start: '2020-02-21T11:01:00+01:00', end: '2020-06-30T23:59:00+02:00', sections: []