@transportme/load-ptv-gtfs 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,7 +76,7 @@ export default class StopsLoader {
|
|
|
76
76
|
|
|
77
77
|
updateStopName(stop) {
|
|
78
78
|
stop.cleanNames = stop.bays
|
|
79
|
-
.filter(bay => bay.stopType === STOP_TYPE[0])
|
|
79
|
+
.filter(bay => bay.stopType === STOP_TYPE[0] || bay.stopType === STOP_TYPE[1])
|
|
80
80
|
.map(bay => sanitiseName(bay.fullStopName))
|
|
81
81
|
.filter((e, i, a) => a.indexOf(e) === i)
|
|
82
82
|
|
|
@@ -93,17 +93,17 @@ export default class StopsLoader {
|
|
|
93
93
|
|
|
94
94
|
updateStopSuburb(stop) {
|
|
95
95
|
stop.cleanSuburbs = stop.bays
|
|
96
|
-
.filter(bay => bay.stopType === STOP_TYPE[0])
|
|
96
|
+
.filter(bay => bay.stopType === STOP_TYPE[0] || bay.stopType === STOP_TYPE[1])
|
|
97
97
|
.map(bay => sanitiseName(bay.suburb))
|
|
98
98
|
.filter((e, i, a) => a.indexOf(e) === i)
|
|
99
99
|
|
|
100
100
|
stop.suburb = stop.bays
|
|
101
|
-
.filter(bay => bay.stopType === STOP_TYPE[0])
|
|
101
|
+
.filter(bay => bay.stopType === STOP_TYPE[0] || bay.stopType === STOP_TYPE[1])
|
|
102
102
|
.map(bay => bay.suburb)
|
|
103
103
|
.filter((e, i, a) => a.indexOf(e) === i)
|
|
104
104
|
.sort()
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
stop.codedSuburbs = stop.cleanSuburbs
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
updateStopLocation(stop) {
|
package/package.json
CHANGED
|
@@ -342,4 +342,40 @@ describe('The GTFS Stops Loader', () => {
|
|
|
342
342
|
// TODO: Find out what the Connex stop is for
|
|
343
343
|
expect(stopData.cleanNames).to.deep.equal(['clifton-hill-railway-station', 'connex'])
|
|
344
344
|
})
|
|
345
|
+
|
|
346
|
+
it('Should use stop and station names and suburbs', async () => {
|
|
347
|
+
let database = new LokiDatabaseConnection('test-db')
|
|
348
|
+
let stops = await database.createCollection('stops')
|
|
349
|
+
|
|
350
|
+
let data = [{
|
|
351
|
+
"stop_id": "vic:rail:THL",
|
|
352
|
+
"stop_name": "Town Hall Railway Station (Melbourne)",
|
|
353
|
+
"stop_lat": "-37.815926",
|
|
354
|
+
"stop_lon": "144.967134",
|
|
355
|
+
"parent_station": "",
|
|
356
|
+
"location_type": "1",
|
|
357
|
+
"platform_code": ""
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"stop_id": "vic:rail:TSC",
|
|
361
|
+
"stop_name": "Town Hall Railway Station (Melbourne)",
|
|
362
|
+
"stop_lat": "-37.815926",
|
|
363
|
+
"stop_lon": "144.967134",
|
|
364
|
+
"parent_station": "",
|
|
365
|
+
"location_type": "1",
|
|
366
|
+
"platform_code": ""
|
|
367
|
+
}]
|
|
368
|
+
|
|
369
|
+
let stopLoader = new StopsLoader('', suburbs, TRANSIT_MODES.metroTrain, database)
|
|
370
|
+
let reader = new GTFSStopsReader('', suburbs)
|
|
371
|
+
|
|
372
|
+
for (let stop of data) await stopLoader.loadStop(reader.processEntity(stop))
|
|
373
|
+
|
|
374
|
+
expect(await stops.countDocuments({})).to.equal(1)
|
|
375
|
+
let stopData = await stops.findDocument({})
|
|
376
|
+
expect(stopData.stopName).to.equal('Town Hall Railway Station')
|
|
377
|
+
expect(stopData.cleanNames).to.deep.equal(['town-hall-railway-station'])
|
|
378
|
+
expect(stopData.suburb).to.deep.equal(['Melbourne'])
|
|
379
|
+
expect(stopData.cleanSuburbs).to.deep.equal(['melbourne'])
|
|
380
|
+
})
|
|
345
381
|
})
|