@transportme/load-ptv-gtfs 1.2.3 → 1.2.5

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
21
+ this.originalName = stopName.replace(/ +/g, ' ').trim()
22
22
  this.location = {
23
23
  type: 'Point',
24
24
  coordinates: [parseFloat(stopLon), parseFloat(stopLat)]
@@ -144,7 +144,7 @@ export class GTFSStop {
144
144
  }
145
145
  }
146
146
 
147
- return { stopNumber: null, stopName: stopName }
147
+ return { stopNumber: null, stopName }
148
148
  }
149
149
 
150
150
  #setStopNumber() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -31,5 +31,21 @@ describe('The GTFS Loaders with the new Tram data', () => {
31
31
  expect(stop).to.not.be.null
32
32
  expect(stop.bays[0].stopNumber).to.equal('45')
33
33
  })
34
+
35
+ it('Should clean up extra spaces', async () => {
36
+ let database = new LokiDatabaseConnection('test-db')
37
+ let stops = await database.createCollection('stops')
38
+
39
+ let loader = new StopsLoader(stopsFile, suburbs, TRANSIT_MODES.tram, database)
40
+ await loader.loadStops()
41
+
42
+ let stop = await stops.findDocument({
43
+ 'stopName': 'Glen Huntly Railway Station/Glen Huntly Road'
44
+ })
45
+
46
+ expect(stop).to.not.be.null
47
+ expect(stop.bays[0].stopNumber).to.equal('61')
48
+ expect(stop.bays[0].originalName).to.equal('Glen Huntly Railway Station/Glen Huntly Rd #61')
49
+ })
34
50
  })
35
51
  })
@@ -2,4 +2,5 @@ stop_id,stop_name,stop_lat,stop_lon
2
2
  "10311","Glenferrie Rd/Wattletree Rd #45","-37.86245520","145.02850849"
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
- "11285","Egerton Rd/Wattletree Rd #43","-37.86170982","145.02275399"
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