parseWarning: {from,to}Loc -> {from,to}Location 💥

This commit is contained in:
Jannis R 2021-12-29 17:00:14 +01:00
parent 90308411fc
commit e0cdd55908
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 26 additions and 28 deletions

View file

@ -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

View file

@ -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)',

View file

@ -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',

View file

@ -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: []