parseLocation: give type: station to stops with stopLocL[]

This commit is contained in:
Jannis R 2020-02-15 19:10:41 +00:00
parent 1abafb5bd4
commit d92eb154c2
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 3 additions and 3 deletions

View file

@ -43,7 +43,7 @@ const parseLocation = (ctx, l) => {
.filter(stop => !!stop) .filter(stop => !!stop)
const stop = { const stop = {
type: l.isMainMast ? 'station' : 'stop', type: l.isMainMast || subStops.length > 0 ? 'station' : 'stop',
id: res.id, id: res.id,
name: l.name || lid.O ? profile.parseStationName(ctx, l.name || lid.O) : null, name: l.name || lid.O ? profile.parseStationName(ctx, l.name || lid.O) : null,
location: 'number' === typeof res.latitude ? res : null // todo: remove `.id` location: 'number' === typeof res.latitude ? res : null // todo: remove `.id`

View file

@ -156,7 +156,7 @@ test('handles recursive references properly', (t) => {
} }
} }
const southernExpected = { const southernExpected = {
type: 'stop', type: 'station',
id: 'southern-platform', id: 'southern-platform',
name: 'southern platform', // lower-cased! name: 'southern platform', // lower-cased!
location: { location: {
@ -177,7 +177,7 @@ test('handles recursive references properly', (t) => {
...fooBusStop, ...fooBusStop,
stopLocL: [0] stopLocL: [0]
}) })
t.equal(type, 'stop') t.equal(type, 'station')
t.deepEqual(stops, [southernExpected]) t.deepEqual(stops, [southernExpected])
t.end() t.end()