@transportme/load-ptv-gtfs 1.2.5 → 1.2.6

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.
@@ -18,7 +18,7 @@ export class GTFSStop {
18
18
 
19
19
  constructor({ stopGTFSID, stopName, stopLat, stopLon }, suburbs) {
20
20
  this.stopGTFSID = stopGTFSID
21
- this.originalName = stopName.replace(/ +/g, ' ').trim()
21
+ this.originalName = stopName.replace(/ \(\w+\.\.\. #/, ' #').replace(/ +/g, ' ').trim()
22
22
  this.location = {
23
23
  type: 'Point',
24
24
  coordinates: [parseFloat(stopLon), parseFloat(stopLat)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -318,6 +318,6 @@ describe('The GTFS Stops Loader', () => {
318
318
  await (new StopsLoader(unionWithSpaces, suburbs, TRANSIT_MODES.bus, database)).loadStops()
319
319
 
320
320
  expect(await stops.countDocuments({})).to.equal(1)
321
- expect((await stops.findDocument({ 'bays.stopGTFSID': '26535' })).bays.length).to.equal(4) // Piangil
321
+ expect((await stops.findDocument({ 'bays.stopGTFSID': '26535' })).bays.length).to.equal(4) // Union Station
322
322
  })
323
323
  })
@@ -47,5 +47,21 @@ describe('The GTFS Loaders with the new Tram data', () => {
47
47
  expect(stop.bays[0].stopNumber).to.equal('61')
48
48
  expect(stop.bays[0].originalName).to.equal('Glen Huntly Railway Station/Glen Huntly Rd #61')
49
49
  })
50
+
51
+ it('Should remove half suburbs in the name', async () => {
52
+ let database = new LokiDatabaseConnection('test-db')
53
+ let stops = await database.createCollection('stops')
54
+
55
+ let loader = new StopsLoader(stopsFile, suburbs, TRANSIT_MODES.tram, database)
56
+ await loader.loadStops()
57
+
58
+ let stop = await stops.findDocument({
59
+ 'stopName': 'Royal Melbourne Hospital-Parkville Railway Station/Royal Parade'
60
+ })
61
+
62
+ expect(stop).to.not.be.null
63
+ expect(stop.bays[0].stopNumber).to.equal('10')
64
+ expect(stop.bays[0].originalName).to.equal('Royal Melbourne Hospital-Parkville Station/Royal Pde #10')
65
+ })
50
66
  })
51
67
  })
@@ -3,4 +3,6 @@ stop_id,stop_name,stop_lat,stop_lon
3
3
  "10371","Duncraig Ave/Wattletree Rd #44","-37.86206934","145.02538150"
4
4
  "1083","Clyde St/Raleigh Rd #42","-37.76969864","144.89884126"
5
5
  "11285","Egerton Rd/Wattletree Rd #43","-37.86170982","145.02275399"
6
- "18404","Glen Huntly Railway Station/Glen Huntly Rd #61","-37.88954800","145.04275047","","","0","Level 0
6
+ "18404","Glen Huntly Railway Station/Glen Huntly Rd #61","-37.88954800","145.04275047","","","0","Level 0
7
+ "17867","Royal Melbourne Hospital-Parkville Station/Royal Pde (Melbo... #10","-37.79992871","144.95750800","","","0","Level 0"
8
+ "17868","Royal Melbourne Hospital-Parkville Station/Royal Pde (Parkv... #10","-37.79954277","144.95759813","","","0","Level 0"