gtfs 3.1.4 → 3.2.3
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 +269 -0
- package/@types/tests.ts +26 -0
- package/@types/tsconfig.json +17 -0
- package/CHANGELOG.md +35 -0
- package/README.md +54 -22
- package/docs/images/node-gtfs-logo.svg +18 -0
- package/lib/db.js +63 -14
- package/lib/export.js +1 -4
- package/lib/gtfs/agencies.js +7 -2
- package/lib/gtfs/attributions.js +7 -2
- package/lib/gtfs/calendar-dates.js +7 -2
- package/lib/gtfs/calendars.js +7 -2
- package/lib/gtfs/fare-attributes.js +7 -2
- package/lib/gtfs/fare-rules.js +7 -2
- package/lib/gtfs/feed-info.js +7 -2
- package/lib/gtfs/frequencies.js +7 -2
- package/lib/gtfs/levels.js +7 -2
- package/lib/gtfs/pathways.js +7 -2
- package/lib/gtfs/routes.js +7 -2
- package/lib/gtfs/shapes.js +16 -11
- package/lib/gtfs/stop-times.js +7 -2
- package/lib/gtfs/stops.js +11 -6
- package/lib/gtfs/transfers.js +7 -2
- package/lib/gtfs/translations.js +7 -2
- package/lib/gtfs/trips.js +7 -2
- package/lib/gtfs-ride/board-alights.js +7 -2
- package/lib/gtfs-ride/ride-feed-infos.js +7 -2
- package/lib/gtfs-ride/rider-trips.js +7 -2
- package/lib/gtfs-ride/riderships.js +7 -2
- package/lib/gtfs-ride/trip-capacities.js +7 -2
- package/lib/import.js +5 -4
- package/lib/non-standard/directions.js +7 -2
- package/lib/non-standard/stop-attributes.js +7 -2
- package/lib/non-standard/timetable-notes-references.js +3 -2
- package/lib/non-standard/timetable-notes.js +7 -2
- package/lib/non-standard/timetable-pages.js +7 -2
- package/lib/non-standard/timetable-stop-order.js +3 -2
- package/lib/non-standard/timetables.js +7 -2
- package/lib/utils.js +4 -1
- package/models/gtfs/agency.js +4 -0
- package/models/gtfs/attributions.js +3 -0
- package/models/gtfs/calendar-dates.js +1 -0
- package/models/gtfs/feed-info.js +3 -0
- package/models/gtfs/levels.js +1 -0
- package/models/gtfs/pathways.js +2 -0
- package/models/gtfs/routes.js +5 -0
- package/models/gtfs/stop-times.js +1 -0
- package/models/gtfs/stops.js +3 -0
- package/models/gtfs/trips.js +2 -0
- package/models/non-standard/stop-attributes.js +1 -0
- package/models/non-standard/timetable-notes.js +1 -0
- package/models/non-standard/timetable-pages.js +1 -0
- package/models/non-standard/timetables.js +2 -0
- package/package.json +20 -15
- package/test/mocha/export-gtfs.js +11 -4
- package/test/mocha/get-agencies.js +9 -3
- package/test/mocha/get-attributions.js +9 -3
- package/test/mocha/get-board-alights.js +9 -3
- package/test/mocha/get-calendar-dates.js +9 -3
- package/test/mocha/get-calendars.js +9 -3
- package/test/mocha/get-db.js +62 -3
- package/test/mocha/get-directions.js +9 -3
- package/test/mocha/get-fare-attributes.js +9 -3
- package/test/mocha/get-fare-rules.js +9 -3
- package/test/mocha/get-feed-info.js +9 -3
- package/test/mocha/get-frequencies.js +9 -3
- package/test/mocha/get-levels.js +3 -3
- package/test/mocha/get-pathways.js +9 -3
- package/test/mocha/get-ride-feed-infos.js +9 -3
- package/test/mocha/get-rider-trips.js +9 -3
- package/test/mocha/get-riderships.js +9 -3
- package/test/mocha/get-routes.js +3 -3
- package/test/mocha/get-shapes-as-geojson.js +9 -3
- package/test/mocha/get-shapes.js +3 -3
- package/test/mocha/get-stop-attributes.js +9 -3
- package/test/mocha/get-stops-as-geojson.js +9 -3
- package/test/mocha/get-stops.js +3 -3
- package/test/mocha/get-stoptimes.js +9 -3
- package/test/mocha/get-timetable-pages.js +9 -3
- package/test/mocha/get-timetable-stop-orders.js +9 -3
- package/test/mocha/get-timetables.js +9 -3
- package/test/mocha/get-transfers.js +9 -3
- package/test/mocha/get-translations.js +9 -3
- package/test/mocha/get-trip-capacities.js +9 -3
- package/test/mocha/get-trips.js +3 -3
- package/test/mocha/import-gtfs.js +4 -4
- package/.prettierrc.js +0 -4
package/models/gtfs/routes.js
CHANGED
|
@@ -13,14 +13,17 @@ const model = {
|
|
|
13
13
|
{
|
|
14
14
|
name: 'route_short_name',
|
|
15
15
|
type: 'varchar(255)',
|
|
16
|
+
nocase: true,
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
name: 'route_long_name',
|
|
19
20
|
type: 'varchar(255)',
|
|
21
|
+
nocase: true,
|
|
20
22
|
},
|
|
21
23
|
{
|
|
22
24
|
name: 'route_desc',
|
|
23
25
|
type: 'varchar(255)',
|
|
26
|
+
nocase: true,
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
29
|
name: 'route_type',
|
|
@@ -37,10 +40,12 @@ const model = {
|
|
|
37
40
|
{
|
|
38
41
|
name: 'route_color',
|
|
39
42
|
type: 'varchar(255)',
|
|
43
|
+
nocase: true,
|
|
40
44
|
},
|
|
41
45
|
{
|
|
42
46
|
name: 'route_text_color',
|
|
43
47
|
type: 'varchar(255)',
|
|
48
|
+
nocase: true,
|
|
44
49
|
},
|
|
45
50
|
{
|
|
46
51
|
name: 'route_sort_order',
|
package/models/gtfs/stops.js
CHANGED
|
@@ -13,14 +13,17 @@ const model = {
|
|
|
13
13
|
{
|
|
14
14
|
name: 'stop_name',
|
|
15
15
|
type: 'varchar(255)',
|
|
16
|
+
nocase: true,
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
name: 'tts_stop_name',
|
|
19
20
|
type: 'varchar(255)',
|
|
21
|
+
nocase: true,
|
|
20
22
|
},
|
|
21
23
|
{
|
|
22
24
|
name: 'stop_desc',
|
|
23
25
|
type: 'varchar(255)',
|
|
26
|
+
nocase: true,
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
29
|
name: 'stop_lat',
|
package/models/gtfs/trips.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtfs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "Import GTFS transit data into SQLite and query routes, stops, times, fares and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"transit",
|
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
"Oskari Groenroos <oskari@groenroos.fi>",
|
|
53
53
|
"Devin Packer",
|
|
54
54
|
"Darius MARTIN",
|
|
55
|
-
"Mike Brocks"
|
|
55
|
+
"Mike Brocks",
|
|
56
|
+
"Matt Moran",
|
|
57
|
+
"Daniel Sörlöv"
|
|
56
58
|
],
|
|
57
59
|
"type": "module",
|
|
58
60
|
"main": "index.js",
|
|
@@ -60,40 +62,43 @@
|
|
|
60
62
|
"gtfs-export": "bin/gtfs-export.js",
|
|
61
63
|
"gtfs-import": "bin/gtfs-import.js"
|
|
62
64
|
},
|
|
65
|
+
"types": "@types",
|
|
63
66
|
"scripts": {
|
|
67
|
+
"dtslint": "dtslint @types",
|
|
64
68
|
"lint": "eslint **/*.js",
|
|
65
69
|
"lint-fix": "eslint **/*.js --fix",
|
|
66
70
|
"test": "eslint **/*.js && NODE_ENV=test mocha ./test/mocha/**/*.js --timeout 2000"
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
69
73
|
"@turf/helpers": "^6.5.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"csv-
|
|
74
|
+
"@vscode/sqlite3": "^5.0.7",
|
|
75
|
+
"chalk": "^5.0.0",
|
|
76
|
+
"csv-parse": "^5.0.4",
|
|
77
|
+
"csv-stringify": "^6.0.5",
|
|
73
78
|
"lodash-es": "^4.17.21",
|
|
74
|
-
"node-fetch": "^3.
|
|
79
|
+
"node-fetch": "^3.1.1",
|
|
75
80
|
"pluralize": "^8.0.0",
|
|
76
|
-
"pretty-error": "^
|
|
81
|
+
"pretty-error": "^4.0.0",
|
|
77
82
|
"promise-map-series": "^0.3.0",
|
|
78
83
|
"recursive-copy": "^2.0.13",
|
|
79
84
|
"sanitize-filename": "^1.6.3",
|
|
80
85
|
"sqlite": "^4.0.23",
|
|
81
|
-
"sqlite3": "^5.0.2",
|
|
82
86
|
"sqlstring-sqlite": "^0.1.1",
|
|
83
87
|
"strip-bom-stream": "^5.0.0",
|
|
84
|
-
"tmp-promise": "^3.0.
|
|
88
|
+
"tmp-promise": "^3.0.3",
|
|
85
89
|
"untildify": "^4.0.0",
|
|
86
90
|
"unzipper": "^0.10.11",
|
|
87
|
-
"yargs": "^17.
|
|
91
|
+
"yargs": "^17.3.1"
|
|
88
92
|
},
|
|
89
93
|
"devDependencies": {
|
|
90
|
-
"
|
|
94
|
+
"dtslint": "^3.4.2",
|
|
95
|
+
"eslint": "^8.7.0",
|
|
91
96
|
"eslint-config-prettier": "^8.3.0",
|
|
92
97
|
"eslint-config-xo": "^0.39.0",
|
|
93
|
-
"husky": "^7.0.
|
|
94
|
-
"mocha": "^9.1.
|
|
95
|
-
"prettier": "^2.
|
|
96
|
-
"pretty-quick": "^3.1.
|
|
98
|
+
"husky": "^7.0.4",
|
|
99
|
+
"mocha": "^9.1.4",
|
|
100
|
+
"prettier": "^2.5.1",
|
|
101
|
+
"pretty-quick": "^3.1.3",
|
|
97
102
|
"should": "^13.2.3"
|
|
98
103
|
},
|
|
99
104
|
"engines": {
|
|
@@ -5,13 +5,19 @@ import path from 'node:path';
|
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { createReadStream, existsSync } from 'node:fs';
|
|
7
7
|
import { rm } from 'node:fs/promises';
|
|
8
|
-
import parse from 'csv-parse';
|
|
8
|
+
import { parse } from 'csv-parse';
|
|
9
9
|
import should from 'should';
|
|
10
10
|
|
|
11
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
12
11
|
import { unzip, generateFolderName } from '../../lib/file-utils.js';
|
|
13
12
|
import config from '../test-config.js';
|
|
14
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
openDb,
|
|
15
|
+
getDb,
|
|
16
|
+
closeDb,
|
|
17
|
+
importGtfs,
|
|
18
|
+
exportGtfs,
|
|
19
|
+
getAgencies,
|
|
20
|
+
} from '../../index.js';
|
|
15
21
|
import models from '../../models/models.js';
|
|
16
22
|
|
|
17
23
|
describe('exportGtfs():', function () {
|
|
@@ -21,7 +27,8 @@ describe('exportGtfs():', function () {
|
|
|
21
27
|
});
|
|
22
28
|
|
|
23
29
|
after(async () => {
|
|
24
|
-
|
|
30
|
+
const db = getDb(config);
|
|
31
|
+
await closeDb(db);
|
|
25
32
|
});
|
|
26
33
|
|
|
27
34
|
this.timeout(10000);
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/* eslint-env mocha */
|
|
2
2
|
import should from 'should';
|
|
3
3
|
|
|
4
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
5
4
|
import config from '../test-config.js';
|
|
6
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
openDb,
|
|
7
|
+
getDb,
|
|
8
|
+
closeDb,
|
|
9
|
+
importGtfs,
|
|
10
|
+
getAgencies,
|
|
11
|
+
} from '../../index.js';
|
|
7
12
|
|
|
8
13
|
describe('getAgencies():', () => {
|
|
9
14
|
before(async () => {
|
|
@@ -12,7 +17,8 @@ describe('getAgencies():', () => {
|
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
after(async () => {
|
|
15
|
-
|
|
20
|
+
const db = getDb(config);
|
|
21
|
+
await closeDb(db);
|
|
16
22
|
});
|
|
17
23
|
|
|
18
24
|
it('should return empty array if no agencies exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getAttributions,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getAttributions():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getAttributions():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no attributions exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getBoardAlights,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getBoardAlights():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getBoardAlights():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no board alights (GTFS-ride)', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getCalendarDates,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getCalendarDates():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getCalendarDates():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no calendar dates exist', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getCalendars,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getCalendars():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getCalendars():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no calendars', async () => {
|
package/test/mocha/get-db.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/* eslint-env mocha */
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
|
+
import fs from 'fs';
|
|
4
5
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
6
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
7
|
+
import { openDb, getDb, closeDb, importGtfs, getShapes } from '../../index.js';
|
|
8
|
+
|
|
9
|
+
const db2Config = {
|
|
10
|
+
...config,
|
|
11
|
+
agencies: [
|
|
12
|
+
{
|
|
13
|
+
...config.agencies[0],
|
|
14
|
+
exclude: ['shapes'],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
sqlitePath: './tmpdb',
|
|
18
|
+
};
|
|
8
19
|
|
|
9
20
|
describe('getDb():', () => {
|
|
10
21
|
before(async () => {
|
|
@@ -13,7 +24,13 @@ describe('getDb():', () => {
|
|
|
13
24
|
});
|
|
14
25
|
|
|
15
26
|
after(async () => {
|
|
16
|
-
|
|
27
|
+
const db = getDb(config);
|
|
28
|
+
await closeDb(db);
|
|
29
|
+
|
|
30
|
+
// Close db2 and then delete it
|
|
31
|
+
const db2 = getDb(db2Config);
|
|
32
|
+
await closeDb(db2);
|
|
33
|
+
fs.unlinkSync(db2Config.sqlitePath);
|
|
17
34
|
});
|
|
18
35
|
|
|
19
36
|
it('should allow raw db queries: calendar_dates', async () => {
|
|
@@ -41,4 +58,46 @@ describe('getDb():', () => {
|
|
|
41
58
|
should.exists(results);
|
|
42
59
|
results.should.have.length(62);
|
|
43
60
|
});
|
|
61
|
+
|
|
62
|
+
it('should allow multiple db connections', async () => {
|
|
63
|
+
const db2 = await openDb(db2Config);
|
|
64
|
+
await importGtfs(db2Config);
|
|
65
|
+
|
|
66
|
+
const db1 = getDb(config);
|
|
67
|
+
|
|
68
|
+
db1.config.filename.should.equal(':memory:');
|
|
69
|
+
db2.config.filename.should.equal('./tmpdb');
|
|
70
|
+
|
|
71
|
+
// Query db1 for shapes
|
|
72
|
+
const shapeId = 'cal_sf_tam';
|
|
73
|
+
const results1 = await getShapes({
|
|
74
|
+
shape_id: shapeId,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const expectedResult = {
|
|
78
|
+
id: 1424,
|
|
79
|
+
shape_id: 'cal_sf_tam',
|
|
80
|
+
shape_pt_lat: 37.45375587083584,
|
|
81
|
+
shape_pt_lon: -122.18063950538635,
|
|
82
|
+
shape_pt_sequence: 279,
|
|
83
|
+
shape_dist_traveled: null,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
should.exist(results1);
|
|
87
|
+
results1.length.should.equal(401);
|
|
88
|
+
results1.should.containEql(expectedResult);
|
|
89
|
+
|
|
90
|
+
// Query db2 for shapes, none should exist
|
|
91
|
+
const results2 = await getShapes(
|
|
92
|
+
{
|
|
93
|
+
shape_id: shapeId,
|
|
94
|
+
},
|
|
95
|
+
[],
|
|
96
|
+
[],
|
|
97
|
+
{ db: db2 }
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
should.exist(results2);
|
|
101
|
+
results2.length.should.equal(0);
|
|
102
|
+
});
|
|
44
103
|
});
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getDirections,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getDirections():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getDirections():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no directions', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getFareAttributes,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getFareAttributes():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getFareAttributes():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no fare_attributes', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getFareRules,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getFareRules():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getFareRules():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no fare_rules', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getFeedInfo,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getFeedInfo():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getFeedInfo():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no feed info', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getFrequencies,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getFrequencies():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getFrequencies():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no frequencies', async () => {
|
package/test/mocha/get-levels.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import { importGtfs, getLevels } from '../../index.js';
|
|
6
|
+
import { openDb, getDb, closeDb, importGtfs, getLevels } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
describe('getLevels():', () => {
|
|
10
9
|
before(async () => {
|
|
@@ -13,7 +12,8 @@ describe('getLevels():', () => {
|
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
after(async () => {
|
|
16
|
-
|
|
15
|
+
const db = getDb(config);
|
|
16
|
+
await closeDb(db);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('should return empty array if no levels', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getPathways,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getPathways():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getPathways():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no pathways', async () => {
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
|
-
import { openDb, closeDb } from '../../lib/db.js';
|
|
6
5
|
import config from '../test-config.js';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
openDb,
|
|
8
|
+
getDb,
|
|
9
|
+
closeDb,
|
|
10
|
+
importGtfs,
|
|
11
|
+
getRideFeedInfos,
|
|
12
|
+
} from '../../index.js';
|
|
8
13
|
|
|
9
14
|
describe('getRideFeedInfos():', () => {
|
|
10
15
|
before(async () => {
|
|
@@ -13,7 +18,8 @@ describe('getRideFeedInfos():', () => {
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
after(async () => {
|
|
16
|
-
|
|
21
|
+
const db = getDb(config);
|
|
22
|
+
await closeDb(db);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
it('should return empty array if no ride-feed-infos (GTFS-ride)', async () => {
|