gtfs 3.8.0 → 4.0.1

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.
Files changed (90) hide show
  1. package/@types/index.d.ts +130 -137
  2. package/@types/tests.ts +18 -13
  3. package/CHANGELOG.md +18 -0
  4. package/README.md +233 -212
  5. package/config-sample-rtupdates.json +6 -18
  6. package/lib/advancedQuery.js +8 -17
  7. package/lib/db.js +35 -59
  8. package/lib/export.js +16 -10
  9. package/lib/gtfs/agencies.js +8 -6
  10. package/lib/gtfs/areas.js +8 -11
  11. package/lib/gtfs/attributions.js +8 -6
  12. package/lib/gtfs/calendar-dates.js +8 -6
  13. package/lib/gtfs/calendars.js +8 -6
  14. package/lib/gtfs/fare-attributes.js +8 -6
  15. package/lib/gtfs/fare-leg-rules.js +8 -6
  16. package/lib/gtfs/fare-products.js +8 -6
  17. package/lib/gtfs/fare-rules.js +8 -6
  18. package/lib/gtfs/fare-transfer-rules.js +8 -6
  19. package/lib/gtfs/feed-info.js +8 -6
  20. package/lib/gtfs/frequencies.js +8 -6
  21. package/lib/gtfs/levels.js +8 -11
  22. package/lib/gtfs/pathways.js +8 -6
  23. package/lib/gtfs/routes.js +8 -11
  24. package/lib/gtfs/shapes.js +34 -39
  25. package/lib/gtfs/stop-areas.js +8 -6
  26. package/lib/gtfs/stop-times.js +8 -6
  27. package/lib/gtfs/stops.js +27 -33
  28. package/lib/gtfs/transfers.js +8 -6
  29. package/lib/gtfs/translations.js +8 -6
  30. package/lib/gtfs/trips.js +8 -11
  31. package/lib/gtfs-realtime/service-alerts.js +9 -7
  32. package/lib/gtfs-realtime/stop-times-updates.js +9 -7
  33. package/lib/gtfs-realtime/trip-updates.js +9 -7
  34. package/lib/gtfs-realtime/vehicle-positions.js +9 -7
  35. package/lib/gtfs-ride/board-alights.js +8 -6
  36. package/lib/gtfs-ride/ride-feed-infos.js +8 -6
  37. package/lib/gtfs-ride/rider-trips.js +8 -6
  38. package/lib/gtfs-ride/riderships.js +8 -6
  39. package/lib/gtfs-ride/trip-capacities.js +8 -6
  40. package/lib/gtfs.js +3 -9
  41. package/lib/import.js +213 -273
  42. package/lib/non-standard/directions.js +8 -6
  43. package/lib/non-standard/stop-attributes.js +8 -6
  44. package/lib/non-standard/timetable-notes-references.js +8 -6
  45. package/lib/non-standard/timetable-notes.js +8 -6
  46. package/lib/non-standard/timetable-pages.js +8 -6
  47. package/lib/non-standard/timetable-stop-order.js +8 -6
  48. package/lib/non-standard/timetables.js +8 -6
  49. package/lib/non-standard/trips-dated-vehicle-journey.js +9 -7
  50. package/package.json +4 -4
  51. package/test/mocha/advanced-query.js +9 -15
  52. package/test/mocha/export-gtfs.js +5 -6
  53. package/test/mocha/fare-transfer-rules.js +32 -0
  54. package/test/mocha/get-agencies.js +13 -19
  55. package/test/mocha/get-areas.js +27 -0
  56. package/test/mocha/get-attributions.js +7 -13
  57. package/test/mocha/get-board-alights.js +7 -13
  58. package/test/mocha/get-calendar-dates.js +11 -17
  59. package/test/mocha/get-calendars.js +11 -17
  60. package/test/mocha/get-directions.js +7 -13
  61. package/test/mocha/get-fare-attributes.js +9 -15
  62. package/test/mocha/get-fare-leg-rules.js +27 -0
  63. package/test/mocha/get-fare-products.js +27 -0
  64. package/test/mocha/get-fare-rules.js +9 -15
  65. package/test/mocha/get-feed-info.js +7 -13
  66. package/test/mocha/get-frequencies.js +7 -13
  67. package/test/mocha/get-levels.js +7 -7
  68. package/test/mocha/get-pathways.js +7 -13
  69. package/test/mocha/get-ride-feed-infos.js +7 -13
  70. package/test/mocha/get-rider-trips.js +7 -13
  71. package/test/mocha/get-riderships.js +7 -13
  72. package/test/mocha/get-routes.js +13 -13
  73. package/test/mocha/get-shapes-as-geojson.js +14 -15
  74. package/test/mocha/get-shapes.js +25 -25
  75. package/test/mocha/get-stop-attributes.js +7 -13
  76. package/test/mocha/get-stops-as-geojson.js +13 -19
  77. package/test/mocha/get-stops.js +19 -19
  78. package/test/mocha/get-stoptimes.js +11 -17
  79. package/test/mocha/get-timetable-pages.js +7 -13
  80. package/test/mocha/get-timetable-stop-orders.js +6 -7
  81. package/test/mocha/get-timetables.js +7 -13
  82. package/test/mocha/get-transfers.js +7 -13
  83. package/test/mocha/get-translations.js +7 -13
  84. package/test/mocha/get-trip-capacities.js +7 -13
  85. package/test/mocha/get-trips.js +9 -9
  86. package/test/mocha/import-gtfs.js +11 -11
  87. package/test/mocha/{get-db.js → open-db.js} +37 -29
  88. package/test/mocha/raw-query.js +34 -0
  89. package/test/mocha/exec-raw-query.js +0 -39
  90. package/test/mocha/run-raw-query.js +0 -54
@@ -5,7 +5,6 @@ import should from 'should';
5
5
  import config from '../test-config.js';
6
6
  import {
7
7
  openDb,
8
- getDb,
9
8
  closeDb,
10
9
  importGtfs,
11
10
  getShapesAsGeoJSON,
@@ -13,18 +12,18 @@ import {
13
12
 
14
13
  describe('getShapesAsGeoJSON():', () => {
15
14
  before(async () => {
16
- await openDb(config);
15
+ openDb(config);
17
16
  await importGtfs(config);
18
17
  });
19
18
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
19
+ after(() => {
20
+ const db = openDb(config);
21
+ closeDb(db);
23
22
  });
24
23
 
25
- it('should return geojson with an empty features array if no shapes exist', async () => {
24
+ it('should return geojson with an empty features array if no shapes exist', () => {
26
25
  const shapeId = 'fake-shape-id';
27
- const geojson = await getShapesAsGeoJSON({
26
+ const geojson = getShapesAsGeoJSON({
28
27
  shape_id: shapeId,
29
28
  });
30
29
 
@@ -33,8 +32,8 @@ describe('getShapesAsGeoJSON():', () => {
33
32
  geojson.features.should.have.length(0);
34
33
  });
35
34
 
36
- it('should return geojson with shapes if they exist', async () => {
37
- const geojson = await getShapesAsGeoJSON();
35
+ it('should return geojson with shapes if they exist', () => {
36
+ const geojson = getShapesAsGeoJSON();
38
37
 
39
38
  should.exist(geojson);
40
39
  geojson.type.should.equal('FeatureCollection');
@@ -44,10 +43,10 @@ describe('getShapesAsGeoJSON():', () => {
44
43
  geojson.features[0].properties.route_color.should.startWith('#');
45
44
  });
46
45
 
47
- it('should return geojson with shapes for a specific routeId', async () => {
46
+ it('should return geojson with shapes for a specific routeId', () => {
48
47
  const routeId = 'Lo-16APR';
49
48
 
50
- const geojson = await getShapesAsGeoJSON({
49
+ const geojson = getShapesAsGeoJSON({
51
50
  route_id: routeId,
52
51
  });
53
52
 
@@ -59,11 +58,11 @@ describe('getShapesAsGeoJSON():', () => {
59
58
  geojson.features[0].properties.route_color.should.startWith('#');
60
59
  });
61
60
 
62
- it('should return geojson with shapes for a specific routeId and directionId', async () => {
61
+ it('should return geojson with shapes for a specific routeId and directionId', () => {
63
62
  const routeId = 'Lo-16APR';
64
63
  const directionId = 0;
65
64
 
66
- const geojson = await getShapesAsGeoJSON({
65
+ const geojson = getShapesAsGeoJSON({
67
66
  route_id: routeId,
68
67
  direction_id: directionId,
69
68
  });
@@ -76,10 +75,10 @@ describe('getShapesAsGeoJSON():', () => {
76
75
  geojson.features[0].properties.route_color.should.startWith('#');
77
76
  });
78
77
 
79
- it('should return geojson with shapes for a specific shapeId', async () => {
78
+ it('should return geojson with shapes for a specific shapeId', () => {
80
79
  const shapeId = 'cal_sf_tam';
81
80
 
82
- const geojson = await getShapesAsGeoJSON({
81
+ const geojson = getShapesAsGeoJSON({
83
82
  shape_id: shapeId,
84
83
  });
85
84
 
@@ -3,34 +3,34 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import { openDb, getDb, closeDb, importGtfs, getShapes } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getShapes } from '../../index.js';
7
7
 
8
8
  describe('getShapes():', () => {
9
9
  before(async () => {
10
- await openDb(config);
10
+ openDb(config);
11
11
  await importGtfs(config);
12
12
  });
13
13
 
14
- after(async () => {
15
- const db = getDb(config);
16
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
17
17
  });
18
18
 
19
- it('should return an empty array if no shapes exist', async () => {
19
+ it('should return an empty array if no shapes exist', () => {
20
20
  const shapeId = 'fake-shape-id';
21
21
 
22
- const results = await getShapes({
22
+ const results = getShapes({
23
23
  shape_id: shapeId,
24
24
  });
25
25
  should.exists(results);
26
26
  results.should.have.length(0);
27
27
  });
28
28
 
29
- it('should return an empty array if no matching trips exist', async () => {
29
+ it('should return an empty array if no matching trips exist', () => {
30
30
  const routeId = 'TaSj-16APR';
31
31
  const serviceId = 'fake-service-id';
32
32
 
33
- const results = await getShapes({
33
+ const results = getShapes({
34
34
  route_id: routeId,
35
35
  service_id: serviceId,
36
36
  });
@@ -38,8 +38,8 @@ describe('getShapes():', () => {
38
38
  results.should.have.length(0);
39
39
  });
40
40
 
41
- it('should return array of shapes', async () => {
42
- const results = await getShapes({}, [
41
+ it('should return array of shapes', () => {
42
+ const results = getShapes({}, [
43
43
  'shape_id',
44
44
  'shape_pt_lat',
45
45
  'shape_pt_lon',
@@ -60,9 +60,9 @@ describe('getShapes():', () => {
60
60
  results.should.containEql(expectedResult);
61
61
  });
62
62
 
63
- it('should return array of shapes by route', async () => {
63
+ it('should return array of shapes by route', () => {
64
64
  const routeId = 'TaSj-16APR';
65
- const results = await getShapes(
65
+ const results = getShapes(
66
66
  {
67
67
  route_id: routeId,
68
68
  },
@@ -88,8 +88,8 @@ describe('getShapes():', () => {
88
88
  results.should.containEql(expectedResult);
89
89
  });
90
90
 
91
- it('should return array of shapes for multiple routes', async () => {
92
- const results = await getShapes(
91
+ it('should return array of shapes for multiple routes', () => {
92
+ const results = getShapes(
93
93
  {
94
94
  route_id: ['Lo-16APR', 'Li-16APR'],
95
95
  },
@@ -115,8 +115,8 @@ describe('getShapes():', () => {
115
115
  results.should.containEql(expectedResult);
116
116
  });
117
117
 
118
- it('should return empty array of for invalid route', async () => {
119
- const results = await getShapes({
118
+ it('should return empty array of for invalid route', () => {
119
+ const results = getShapes({
120
120
  route_id: 'not-valid',
121
121
  });
122
122
 
@@ -124,10 +124,10 @@ describe('getShapes():', () => {
124
124
  results.length.should.equal(0);
125
125
  });
126
126
 
127
- it('should return array of shapes by route and direction', async () => {
127
+ it('should return array of shapes by route and direction', () => {
128
128
  const routeId = 'TaSj-16APR';
129
129
  const directionId = 0;
130
- const results = await getShapes(
130
+ const results = getShapes(
131
131
  {
132
132
  route_id: routeId,
133
133
  direction_id: directionId,
@@ -154,9 +154,9 @@ describe('getShapes():', () => {
154
154
  results.should.containEql(expectedResult);
155
155
  });
156
156
 
157
- it('should return array of shapes for specific trip_id', async () => {
157
+ it('should return array of shapes for specific trip_id', () => {
158
158
  const tripId = '329';
159
- const results = await getShapes(
159
+ const results = getShapes(
160
160
  {
161
161
  trip_id: tripId,
162
162
  },
@@ -182,9 +182,9 @@ describe('getShapes():', () => {
182
182
  results.should.containEql(expectedResult);
183
183
  });
184
184
 
185
- it('should return array of shapes for specific service_id', async () => {
185
+ it('should return array of shapes for specific service_id', () => {
186
186
  const serviceId = 'CT-16APR-Caltrain-Sunday-02';
187
- const results = await getShapes(
187
+ const results = getShapes(
188
188
  {
189
189
  service_id: serviceId,
190
190
  },
@@ -210,9 +210,9 @@ describe('getShapes():', () => {
210
210
  results.should.containEql(expectedResult);
211
211
  });
212
212
 
213
- it('should return array of shapes for specific shape_id', async () => {
213
+ it('should return array of shapes for specific shape_id', () => {
214
214
  const shapeId = 'cal_sf_tam';
215
- const results = await getShapes(
215
+ const results = getShapes(
216
216
  {
217
217
  shape_id: shapeId,
218
218
  },
@@ -3,29 +3,23 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getStopAttributes,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getStopAttributes } from '../../index.js';
13
7
 
14
8
  describe('getStopAttributes():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return empty array if no stop attributes', async () => {
19
+ it('should return empty array if no stop attributes', () => {
26
20
  const stopId = 'fake-stop-id';
27
21
 
28
- const results = await getStopAttributes({
22
+ const results = getStopAttributes({
29
23
  stop_id: stopId,
30
24
  });
31
25
  should.exists(results);
@@ -3,28 +3,22 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getStopsAsGeoJSON,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getStopsAsGeoJSON } from '../../index.js';
13
7
 
14
8
  describe('getStopsAsGeoJSON(): ', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return geojson with an empty features array if no stops exist', async () => {
19
+ it('should return geojson with an empty features array if no stops exist', () => {
26
20
  const stopId = 'fake-stop-id';
27
- const geojson = await getStopsAsGeoJSON({
21
+ const geojson = getStopsAsGeoJSON({
28
22
  stop_id: stopId,
29
23
  });
30
24
 
@@ -33,8 +27,8 @@ describe('getStopsAsGeoJSON(): ', () => {
33
27
  geojson.features.should.have.length(0);
34
28
  });
35
29
 
36
- it('should return geojson with stops if they exist', async () => {
37
- const geojson = await getStopsAsGeoJSON();
30
+ it('should return geojson with stops if they exist', () => {
31
+ const geojson = getStopsAsGeoJSON();
38
32
 
39
33
  should.exist(geojson);
40
34
  geojson.type.should.equal('FeatureCollection');
@@ -43,10 +37,10 @@ describe('getStopsAsGeoJSON(): ', () => {
43
37
  geojson.features[0].geometry.coordinates.length.should.equal(2);
44
38
  });
45
39
 
46
- it('should return geojson with stops if they exist for a specific stopId', async () => {
40
+ it('should return geojson with stops if they exist for a specific stopId', () => {
47
41
  const stopId = '70031';
48
42
 
49
- const geojson = await getStopsAsGeoJSON({
43
+ const geojson = getStopsAsGeoJSON({
50
44
  stop_id: stopId,
51
45
  });
52
46
 
@@ -57,10 +51,10 @@ describe('getStopsAsGeoJSON(): ', () => {
57
51
  geojson.features[0].geometry.coordinates.length.should.equal(2);
58
52
  });
59
53
 
60
- it('should return geojson with stops if they exist for a specific shapeId', async () => {
54
+ it('should return geojson with stops if they exist for a specific shapeId', () => {
61
55
  const shapeId = 'cal_sf_tam';
62
56
 
63
- const geojson = await getStopsAsGeoJSON({
57
+ const geojson = getStopsAsGeoJSON({
64
58
  shape_id: shapeId,
65
59
  });
66
60
 
@@ -3,31 +3,31 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import { openDb, getDb, closeDb, importGtfs, getStops } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getStops } from '../../index.js';
7
7
 
8
8
  describe('getStops():', () => {
9
9
  before(async () => {
10
- await openDb(config);
10
+ openDb(config);
11
11
  await importGtfs(config);
12
12
  });
13
13
 
14
- after(async () => {
15
- const db = getDb(config);
16
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
17
17
  });
18
18
 
19
- it('should return an empty array if no stops exist', async () => {
19
+ it('should return an empty array if no stops exist', () => {
20
20
  const stopId = 'fake-stop-id';
21
21
 
22
- const results = await getStops({
22
+ const results = getStops({
23
23
  stop_id: stopId,
24
24
  });
25
25
  should.exists(results);
26
26
  results.should.have.length(0);
27
27
  });
28
28
 
29
- it('should return array of stops', async () => {
30
- const results = await getStops();
29
+ it('should return array of stops', () => {
30
+ const results = getStops();
31
31
 
32
32
  const expectedResult = {
33
33
  stop_id: 'ctbu',
@@ -52,10 +52,10 @@ describe('getStops():', () => {
52
52
  results.should.containEql(expectedResult);
53
53
  });
54
54
 
55
- it('should return array of stops for a specific stopId', async () => {
55
+ it('should return array of stops for a specific stopId', () => {
56
56
  const stopId = '70031';
57
57
 
58
- const results = await getStops({
58
+ const results = getStops({
59
59
  stop_id: stopId,
60
60
  });
61
61
 
@@ -84,10 +84,10 @@ describe('getStops():', () => {
84
84
  results.should.match(expectedResult);
85
85
  });
86
86
 
87
- it('should return array of stops if it exists for a specific route_id', async () => {
87
+ it('should return array of stops if it exists for a specific route_id', () => {
88
88
  const routeId = 'Bu-16APR';
89
89
 
90
- const results = await getStops(
90
+ const results = getStops(
91
91
  {
92
92
  route_id: routeId,
93
93
  },
@@ -132,11 +132,11 @@ describe('getStops():', () => {
132
132
  }
133
133
  });
134
134
 
135
- it('should return array of stops if it exists for a specific route_id and direction_id', async () => {
135
+ it('should return array of stops if it exists for a specific route_id and direction_id', () => {
136
136
  const routeId = 'Bu-16APR';
137
137
  const directionId = 1;
138
138
 
139
- const results = await getStops(
139
+ const results = getStops(
140
140
  {
141
141
  route_id: routeId,
142
142
  direction_id: directionId,
@@ -170,10 +170,10 @@ describe('getStops():', () => {
170
170
  }
171
171
  });
172
172
 
173
- it('should return array of stops for a specific trip_id', async () => {
173
+ it('should return array of stops for a specific trip_id', () => {
174
174
  const tripId = '427a';
175
175
 
176
- const results = await getStops(
176
+ const results = getStops(
177
177
  {
178
178
  trip_id: tripId,
179
179
  },
@@ -218,10 +218,10 @@ describe('getStops():', () => {
218
218
  }
219
219
  });
220
220
 
221
- it('should return array of stops if it exists for a specific shape_id', async () => {
221
+ it('should return array of stops if it exists for a specific shape_id', () => {
222
222
  const shapeId = 'cal_sf_tam';
223
223
 
224
- const results = await getStops(
224
+ const results = getStops(
225
225
  {
226
226
  shape_id: shapeId,
227
227
  },
@@ -3,39 +3,33 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getStoptimes,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getStoptimes } from '../../index.js';
13
7
 
14
8
  describe('getStoptimes():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return an empty array if no stoptimes exist for given agency', async () => {
19
+ it('should return an empty array if no stoptimes exist for given agency', () => {
26
20
  const stopId = 'fake-stop-id';
27
21
 
28
- const results = await getStoptimes({
22
+ const results = getStoptimes({
29
23
  stop_id: stopId,
30
24
  });
31
25
  should.exists(results);
32
26
  results.should.have.length(0);
33
27
  });
34
28
 
35
- it('should return array of stoptimes for given stop_id', async () => {
29
+ it('should return array of stoptimes for given stop_id', () => {
36
30
  const stopId = '70011';
37
31
 
38
- const results = await getStoptimes({
32
+ const results = getStoptimes({
39
33
  stop_id: stopId,
40
34
  });
41
35
  should.exist(results);
@@ -46,10 +40,10 @@ describe('getStoptimes():', () => {
46
40
  }
47
41
  });
48
42
 
49
- it('should return array of stoptimes for given trip_id ordered by stop_sequence', async () => {
43
+ it('should return array of stoptimes for given trip_id ordered by stop_sequence', () => {
50
44
  const tripId = '421a';
51
45
 
52
- const results = await getStoptimes(
46
+ const results = getStoptimes(
53
47
  {
54
48
  trip_id: tripId,
55
49
  },
@@ -3,29 +3,23 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getTimetablePages,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getTimetablePages } from '../../index.js';
13
7
 
14
8
  describe('getTimetablePages():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return empty array if no timetable pages (GTFS-to-HTML timetables)', async () => {
19
+ it('should return empty array if no timetable pages (GTFS-to-HTML timetables)', () => {
26
20
  const timetablePageId = 'fake-timetable-page-id';
27
21
 
28
- const results = await getTimetablePages({
22
+ const results = getTimetablePages({
29
23
  timetable_page_id: timetablePageId,
30
24
  });
31
25
  should.exists(results);
@@ -5,7 +5,6 @@ import should from 'should';
5
5
  import config from '../test-config.js';
6
6
  import {
7
7
  openDb,
8
- getDb,
9
8
  closeDb,
10
9
  importGtfs,
11
10
  getTimetableStopOrders,
@@ -13,19 +12,19 @@ import {
13
12
 
14
13
  describe('getTimetableStopOrders():', () => {
15
14
  before(async () => {
16
- await openDb(config);
15
+ openDb(config);
17
16
  await importGtfs(config);
18
17
  });
19
18
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
19
+ after(() => {
20
+ const db = openDb(config);
21
+ closeDb(db);
23
22
  });
24
23
 
25
- it('should return empty array if no timetable stop orders (GTFS-to-HTML timetables)', async () => {
24
+ it('should return empty array if no timetable stop orders (GTFS-to-HTML timetables)', () => {
26
25
  const timetableId = 'fake-timetable-id';
27
26
 
28
- const results = await getTimetableStopOrders({
27
+ const results = getTimetableStopOrders({
29
28
  timetable_id: timetableId,
30
29
  });
31
30
  should.exists(results);
@@ -3,29 +3,23 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getTimetables,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getTimetables } from '../../index.js';
13
7
 
14
8
  describe('getTimetables():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return empty array if no timetables (GTFS-to-HTML timetables)', async () => {
19
+ it('should return empty array if no timetables (GTFS-to-HTML timetables)', () => {
26
20
  const timetableId = 'fake-timetable-id';
27
21
 
28
- const results = await getTimetables({
22
+ const results = getTimetables({
29
23
  timetable_id: timetableId,
30
24
  });
31
25
  should.exists(results);
@@ -3,29 +3,23 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getTransfers,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getTransfers } from '../../index.js';
13
7
 
14
8
  describe('getTransfers():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return empty array if no transfers', async () => {
19
+ it('should return empty array if no transfers', () => {
26
20
  const fromStopId = 'fake-stop-id';
27
21
 
28
- const results = await getTransfers({
22
+ const results = getTransfers({
29
23
  from_stop_id: fromStopId,
30
24
  });
31
25
  should.exists(results);
@@ -3,29 +3,23 @@
3
3
  import should from 'should';
4
4
 
5
5
  import config from '../test-config.js';
6
- import {
7
- openDb,
8
- getDb,
9
- closeDb,
10
- importGtfs,
11
- getTranslations,
12
- } from '../../index.js';
6
+ import { openDb, closeDb, importGtfs, getTranslations } from '../../index.js';
13
7
 
14
8
  describe('getTranslations():', () => {
15
9
  before(async () => {
16
- await openDb(config);
10
+ openDb(config);
17
11
  await importGtfs(config);
18
12
  });
19
13
 
20
- after(async () => {
21
- const db = getDb(config);
22
- await closeDb(db);
14
+ after(() => {
15
+ const db = openDb(config);
16
+ closeDb(db);
23
17
  });
24
18
 
25
- it('should return empty array if no translations', async () => {
19
+ it('should return empty array if no translations', () => {
26
20
  const fieldName = 'fake-field-name';
27
21
 
28
- const results = await getTranslations({
22
+ const results = getTranslations({
29
23
  field_name: fieldName,
30
24
  });
31
25
  should.exists(results);