gtfs 3.8.0 → 4.0.0
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.
- package/@types/index.d.ts +35 -60
- package/@types/tests.ts +18 -13
- package/CHANGELOG.md +10 -0
- package/README.md +227 -207
- package/lib/advancedQuery.js +8 -17
- package/lib/db.js +29 -59
- package/lib/export.js +16 -10
- package/lib/gtfs/agencies.js +8 -6
- package/lib/gtfs/areas.js +8 -11
- package/lib/gtfs/attributions.js +8 -6
- package/lib/gtfs/calendar-dates.js +8 -6
- package/lib/gtfs/calendars.js +8 -6
- package/lib/gtfs/fare-attributes.js +8 -6
- package/lib/gtfs/fare-leg-rules.js +8 -6
- package/lib/gtfs/fare-products.js +8 -6
- package/lib/gtfs/fare-rules.js +8 -6
- package/lib/gtfs/fare-transfer-rules.js +8 -6
- package/lib/gtfs/feed-info.js +8 -6
- package/lib/gtfs/frequencies.js +8 -6
- package/lib/gtfs/levels.js +8 -11
- package/lib/gtfs/pathways.js +8 -6
- package/lib/gtfs/routes.js +8 -11
- package/lib/gtfs/shapes.js +34 -39
- package/lib/gtfs/stop-areas.js +8 -6
- package/lib/gtfs/stop-times.js +8 -6
- package/lib/gtfs/stops.js +27 -33
- package/lib/gtfs/transfers.js +8 -6
- package/lib/gtfs/translations.js +8 -6
- package/lib/gtfs/trips.js +8 -11
- package/lib/gtfs-realtime/service-alerts.js +9 -7
- package/lib/gtfs-realtime/stop-times-updates.js +9 -7
- package/lib/gtfs-realtime/trip-updates.js +9 -7
- package/lib/gtfs-realtime/vehicle-positions.js +9 -7
- package/lib/gtfs-ride/board-alights.js +8 -6
- package/lib/gtfs-ride/ride-feed-infos.js +8 -6
- package/lib/gtfs-ride/rider-trips.js +8 -6
- package/lib/gtfs-ride/riderships.js +8 -6
- package/lib/gtfs-ride/trip-capacities.js +8 -6
- package/lib/gtfs.js +3 -9
- package/lib/import.js +195 -202
- package/lib/non-standard/directions.js +8 -6
- package/lib/non-standard/stop-attributes.js +8 -6
- package/lib/non-standard/timetable-notes-references.js +8 -6
- package/lib/non-standard/timetable-notes.js +8 -6
- package/lib/non-standard/timetable-pages.js +8 -6
- package/lib/non-standard/timetable-stop-order.js +8 -6
- package/lib/non-standard/timetables.js +8 -6
- package/lib/non-standard/trips-dated-vehicle-journey.js +9 -7
- package/package.json +2 -3
- package/test/mocha/advanced-query.js +9 -15
- package/test/mocha/export-gtfs.js +5 -6
- package/test/mocha/fare-transfer-rules.js +32 -0
- package/test/mocha/get-agencies.js +13 -19
- package/test/mocha/get-areas.js +27 -0
- package/test/mocha/get-attributions.js +7 -13
- package/test/mocha/get-board-alights.js +7 -13
- package/test/mocha/get-calendar-dates.js +11 -17
- package/test/mocha/get-calendars.js +11 -17
- package/test/mocha/get-directions.js +7 -13
- package/test/mocha/get-fare-attributes.js +9 -15
- package/test/mocha/get-fare-leg-rules.js +27 -0
- package/test/mocha/get-fare-products.js +27 -0
- package/test/mocha/get-fare-rules.js +9 -15
- package/test/mocha/get-feed-info.js +7 -13
- package/test/mocha/get-frequencies.js +7 -13
- package/test/mocha/get-levels.js +7 -7
- package/test/mocha/get-pathways.js +7 -13
- package/test/mocha/get-ride-feed-infos.js +7 -13
- package/test/mocha/get-rider-trips.js +7 -13
- package/test/mocha/get-riderships.js +7 -13
- package/test/mocha/get-routes.js +13 -13
- package/test/mocha/get-shapes-as-geojson.js +14 -15
- package/test/mocha/get-shapes.js +25 -25
- package/test/mocha/get-stop-attributes.js +7 -13
- package/test/mocha/get-stops-as-geojson.js +13 -19
- package/test/mocha/get-stops.js +19 -19
- package/test/mocha/get-stoptimes.js +11 -17
- package/test/mocha/get-timetable-pages.js +7 -13
- package/test/mocha/get-timetable-stop-orders.js +6 -7
- package/test/mocha/get-timetables.js +7 -13
- package/test/mocha/get-transfers.js +7 -13
- package/test/mocha/get-translations.js +7 -13
- package/test/mocha/get-trip-capacities.js +7 -13
- package/test/mocha/get-trips.js +9 -9
- package/test/mocha/import-gtfs.js +11 -11
- package/test/mocha/{get-db.js → open-db.js} +37 -29
- package/test/mocha/raw-query.js +34 -0
- package/test/mocha/exec-raw-query.js +0 -39
- package/test/mocha/run-raw-query.js +0 -54
package/test/mocha/get-shapes.js
CHANGED
|
@@ -3,34 +3,34 @@
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
5
|
import config from '../test-config.js';
|
|
6
|
-
import { openDb,
|
|
6
|
+
import { openDb, closeDb, importGtfs, getShapes } from '../../index.js';
|
|
7
7
|
|
|
8
8
|
describe('getShapes():', () => {
|
|
9
9
|
before(async () => {
|
|
10
|
-
|
|
10
|
+
openDb(config);
|
|
11
11
|
await importGtfs(config);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
after(
|
|
15
|
-
const db =
|
|
16
|
-
|
|
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',
|
|
19
|
+
it('should return an empty array if no shapes exist', () => {
|
|
20
20
|
const shapeId = 'fake-shape-id';
|
|
21
21
|
|
|
22
|
-
const results =
|
|
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',
|
|
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 =
|
|
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',
|
|
42
|
-
const results =
|
|
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',
|
|
63
|
+
it('should return array of shapes by route', () => {
|
|
64
64
|
const routeId = 'TaSj-16APR';
|
|
65
|
-
const results =
|
|
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',
|
|
92
|
-
const results =
|
|
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',
|
|
119
|
-
const results =
|
|
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',
|
|
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 =
|
|
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',
|
|
157
|
+
it('should return array of shapes for specific trip_id', () => {
|
|
158
158
|
const tripId = '329';
|
|
159
|
-
const results =
|
|
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',
|
|
185
|
+
it('should return array of shapes for specific service_id', () => {
|
|
186
186
|
const serviceId = 'CT-16APR-Caltrain-Sunday-02';
|
|
187
|
-
const results =
|
|
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',
|
|
213
|
+
it('should return array of shapes for specific shape_id', () => {
|
|
214
214
|
const shapeId = 'cal_sf_tam';
|
|
215
|
-
const results =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
it('should return empty array if no stop attributes',
|
|
19
|
+
it('should return empty array if no stop attributes', () => {
|
|
26
20
|
const stopId = 'fake-stop-id';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
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',
|
|
19
|
+
it('should return geojson with an empty features array if no stops exist', () => {
|
|
26
20
|
const stopId = 'fake-stop-id';
|
|
27
|
-
const geojson =
|
|
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',
|
|
37
|
-
const geojson =
|
|
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',
|
|
40
|
+
it('should return geojson with stops if they exist for a specific stopId', () => {
|
|
47
41
|
const stopId = '70031';
|
|
48
42
|
|
|
49
|
-
const geojson =
|
|
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',
|
|
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 =
|
|
57
|
+
const geojson = getStopsAsGeoJSON({
|
|
64
58
|
shape_id: shapeId,
|
|
65
59
|
});
|
|
66
60
|
|
package/test/mocha/get-stops.js
CHANGED
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
5
|
import config from '../test-config.js';
|
|
6
|
-
import { openDb,
|
|
6
|
+
import { openDb, closeDb, importGtfs, getStops } from '../../index.js';
|
|
7
7
|
|
|
8
8
|
describe('getStops():', () => {
|
|
9
9
|
before(async () => {
|
|
10
|
-
|
|
10
|
+
openDb(config);
|
|
11
11
|
await importGtfs(config);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
after(
|
|
15
|
-
const db =
|
|
16
|
-
|
|
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',
|
|
19
|
+
it('should return an empty array if no stops exist', () => {
|
|
20
20
|
const stopId = 'fake-stop-id';
|
|
21
21
|
|
|
22
|
-
const results =
|
|
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',
|
|
30
|
-
const results =
|
|
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',
|
|
55
|
+
it('should return array of stops for a specific stopId', () => {
|
|
56
56
|
const stopId = '70031';
|
|
57
57
|
|
|
58
|
-
const results =
|
|
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',
|
|
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 =
|
|
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',
|
|
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 =
|
|
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',
|
|
173
|
+
it('should return array of stops for a specific trip_id', () => {
|
|
174
174
|
const tripId = '427a';
|
|
175
175
|
|
|
176
|
-
const results =
|
|
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',
|
|
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 =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
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',
|
|
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 =
|
|
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',
|
|
29
|
+
it('should return array of stoptimes for given stop_id', () => {
|
|
36
30
|
const stopId = '70011';
|
|
37
31
|
|
|
38
|
-
const results =
|
|
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',
|
|
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 =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
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)',
|
|
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 =
|
|
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
|
-
|
|
15
|
+
openDb(config);
|
|
17
16
|
await importGtfs(config);
|
|
18
17
|
});
|
|
19
18
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
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)',
|
|
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 =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
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)',
|
|
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 =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
it('should return empty array if no transfers',
|
|
19
|
+
it('should return empty array if no transfers', () => {
|
|
26
20
|
const fromStopId = 'fake-stop-id';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
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
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
it('should return empty array if no translations',
|
|
19
|
+
it('should return empty array if no translations', () => {
|
|
26
20
|
const fieldName = 'fake-field-name';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getTranslations({
|
|
29
23
|
field_name: fieldName,
|
|
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
|
-
getTripCapacities,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getTripCapacities } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getTripCapacities():', () => {
|
|
15
9
|
before(async () => {
|
|
16
|
-
|
|
10
|
+
openDb(config);
|
|
17
11
|
await importGtfs(config);
|
|
18
12
|
});
|
|
19
13
|
|
|
20
|
-
after(
|
|
21
|
-
const db =
|
|
22
|
-
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
it('should return empty array if no trip capacities (GTFS-ride)',
|
|
19
|
+
it('should return empty array if no trip capacities (GTFS-ride)', () => {
|
|
26
20
|
const tripId = 'fake-trip-id';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getTripCapacities({
|
|
29
23
|
trip_id: tripId,
|
|
30
24
|
});
|
|
31
25
|
should.exists(results);
|
package/test/mocha/get-trips.js
CHANGED
|
@@ -3,33 +3,33 @@
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
5
|
import config from '../test-config.js';
|
|
6
|
-
import { openDb,
|
|
6
|
+
import { openDb, closeDb, importGtfs, getTrips } from '../../index.js';
|
|
7
7
|
|
|
8
8
|
describe('getTrips():', () => {
|
|
9
9
|
before(async () => {
|
|
10
|
-
|
|
10
|
+
openDb(config);
|
|
11
11
|
await importGtfs(config);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
after(
|
|
15
|
-
const db =
|
|
16
|
-
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it('should return empty array if no trips exist',
|
|
19
|
+
it('should return empty array if no trips exist', () => {
|
|
20
20
|
const tripId = 'fake-trip-id';
|
|
21
21
|
|
|
22
|
-
const results =
|
|
22
|
+
const results = getTrips({
|
|
23
23
|
trip_id: tripId,
|
|
24
24
|
});
|
|
25
25
|
should.exists(results);
|
|
26
26
|
results.should.have.length(0);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('should return expected trips',
|
|
29
|
+
it('should return expected trips', () => {
|
|
30
30
|
const routeId = 'Bu-16APR';
|
|
31
31
|
|
|
32
|
-
const results =
|
|
32
|
+
const results = getTrips({
|
|
33
33
|
route_id: routeId,
|
|
34
34
|
});
|
|
35
35
|
|