mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
parseLocation: give type: station
to stops with stopLocL[]
This commit is contained in:
parent
1abafb5bd4
commit
d92eb154c2
2 changed files with 3 additions and 3 deletions
|
@ -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`
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue