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.
Files changed (87) hide show
  1. package/@types/index.d.ts +269 -0
  2. package/@types/tests.ts +26 -0
  3. package/@types/tsconfig.json +17 -0
  4. package/CHANGELOG.md +35 -0
  5. package/README.md +54 -22
  6. package/docs/images/node-gtfs-logo.svg +18 -0
  7. package/lib/db.js +63 -14
  8. package/lib/export.js +1 -4
  9. package/lib/gtfs/agencies.js +7 -2
  10. package/lib/gtfs/attributions.js +7 -2
  11. package/lib/gtfs/calendar-dates.js +7 -2
  12. package/lib/gtfs/calendars.js +7 -2
  13. package/lib/gtfs/fare-attributes.js +7 -2
  14. package/lib/gtfs/fare-rules.js +7 -2
  15. package/lib/gtfs/feed-info.js +7 -2
  16. package/lib/gtfs/frequencies.js +7 -2
  17. package/lib/gtfs/levels.js +7 -2
  18. package/lib/gtfs/pathways.js +7 -2
  19. package/lib/gtfs/routes.js +7 -2
  20. package/lib/gtfs/shapes.js +16 -11
  21. package/lib/gtfs/stop-times.js +7 -2
  22. package/lib/gtfs/stops.js +11 -6
  23. package/lib/gtfs/transfers.js +7 -2
  24. package/lib/gtfs/translations.js +7 -2
  25. package/lib/gtfs/trips.js +7 -2
  26. package/lib/gtfs-ride/board-alights.js +7 -2
  27. package/lib/gtfs-ride/ride-feed-infos.js +7 -2
  28. package/lib/gtfs-ride/rider-trips.js +7 -2
  29. package/lib/gtfs-ride/riderships.js +7 -2
  30. package/lib/gtfs-ride/trip-capacities.js +7 -2
  31. package/lib/import.js +5 -4
  32. package/lib/non-standard/directions.js +7 -2
  33. package/lib/non-standard/stop-attributes.js +7 -2
  34. package/lib/non-standard/timetable-notes-references.js +3 -2
  35. package/lib/non-standard/timetable-notes.js +7 -2
  36. package/lib/non-standard/timetable-pages.js +7 -2
  37. package/lib/non-standard/timetable-stop-order.js +3 -2
  38. package/lib/non-standard/timetables.js +7 -2
  39. package/lib/utils.js +4 -1
  40. package/models/gtfs/agency.js +4 -0
  41. package/models/gtfs/attributions.js +3 -0
  42. package/models/gtfs/calendar-dates.js +1 -0
  43. package/models/gtfs/feed-info.js +3 -0
  44. package/models/gtfs/levels.js +1 -0
  45. package/models/gtfs/pathways.js +2 -0
  46. package/models/gtfs/routes.js +5 -0
  47. package/models/gtfs/stop-times.js +1 -0
  48. package/models/gtfs/stops.js +3 -0
  49. package/models/gtfs/trips.js +2 -0
  50. package/models/non-standard/stop-attributes.js +1 -0
  51. package/models/non-standard/timetable-notes.js +1 -0
  52. package/models/non-standard/timetable-pages.js +1 -0
  53. package/models/non-standard/timetables.js +2 -0
  54. package/package.json +20 -15
  55. package/test/mocha/export-gtfs.js +11 -4
  56. package/test/mocha/get-agencies.js +9 -3
  57. package/test/mocha/get-attributions.js +9 -3
  58. package/test/mocha/get-board-alights.js +9 -3
  59. package/test/mocha/get-calendar-dates.js +9 -3
  60. package/test/mocha/get-calendars.js +9 -3
  61. package/test/mocha/get-db.js +62 -3
  62. package/test/mocha/get-directions.js +9 -3
  63. package/test/mocha/get-fare-attributes.js +9 -3
  64. package/test/mocha/get-fare-rules.js +9 -3
  65. package/test/mocha/get-feed-info.js +9 -3
  66. package/test/mocha/get-frequencies.js +9 -3
  67. package/test/mocha/get-levels.js +3 -3
  68. package/test/mocha/get-pathways.js +9 -3
  69. package/test/mocha/get-ride-feed-infos.js +9 -3
  70. package/test/mocha/get-rider-trips.js +9 -3
  71. package/test/mocha/get-riderships.js +9 -3
  72. package/test/mocha/get-routes.js +3 -3
  73. package/test/mocha/get-shapes-as-geojson.js +9 -3
  74. package/test/mocha/get-shapes.js +3 -3
  75. package/test/mocha/get-stop-attributes.js +9 -3
  76. package/test/mocha/get-stops-as-geojson.js +9 -3
  77. package/test/mocha/get-stops.js +3 -3
  78. package/test/mocha/get-stoptimes.js +9 -3
  79. package/test/mocha/get-timetable-pages.js +9 -3
  80. package/test/mocha/get-timetable-stop-orders.js +9 -3
  81. package/test/mocha/get-timetables.js +9 -3
  82. package/test/mocha/get-transfers.js +9 -3
  83. package/test/mocha/get-translations.js +9 -3
  84. package/test/mocha/get-trip-capacities.js +9 -3
  85. package/test/mocha/get-trips.js +3 -3
  86. package/test/mocha/import-gtfs.js +4 -4
  87. package/.prettierrc.js +0 -4
@@ -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',
@@ -45,6 +45,7 @@ const model = {
45
45
  {
46
46
  name: 'stop_headsign',
47
47
  type: 'varchar(255)',
48
+ nocase: true,
48
49
  },
49
50
  {
50
51
  name: 'pickup_type',
@@ -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',
@@ -21,10 +21,12 @@ const model = {
21
21
  {
22
22
  name: 'trip_headsign',
23
23
  type: 'varchar(255)',
24
+ nocase: true,
24
25
  },
25
26
  {
26
27
  name: 'trip_short_name',
27
28
  type: 'varchar(255)',
29
+ nocase: true,
28
30
  },
29
31
  {
30
32
  name: 'direction_id',
@@ -16,6 +16,7 @@ const model = {
16
16
  {
17
17
  name: 'stop_city',
18
18
  type: 'varchar(255)',
19
+ nocase: true,
19
20
  },
20
21
  ],
21
22
  };
@@ -14,6 +14,7 @@ const model = {
14
14
  {
15
15
  name: 'note',
16
16
  type: 'varchar(2047)',
17
+ nocase: true,
17
18
  },
18
19
  ],
19
20
  };
@@ -14,6 +14,7 @@ const model = {
14
14
  {
15
15
  name: 'filename',
16
16
  type: 'varchar(255)',
17
+ nocase: true,
17
18
  },
18
19
  ],
19
20
  };
@@ -97,10 +97,12 @@ const model = {
97
97
  {
98
98
  name: 'timetable_label',
99
99
  type: 'varchar(255)',
100
+ nocase: true,
100
101
  },
101
102
  {
102
103
  name: 'service_notes',
103
104
  type: 'varchar(255)',
105
+ nocase: true,
104
106
  },
105
107
  {
106
108
  name: 'orientation',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtfs",
3
- "version": "3.1.4",
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
- "chalk": "^4.1.2",
71
- "csv-parse": "^4.16.3",
72
- "csv-stringify": "^5.6.5",
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.0.0",
79
+ "node-fetch": "^3.1.1",
75
80
  "pluralize": "^8.0.0",
76
- "pretty-error": "^3.0.4",
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.2",
88
+ "tmp-promise": "^3.0.3",
85
89
  "untildify": "^4.0.0",
86
90
  "unzipper": "^0.10.11",
87
- "yargs": "^17.2.1"
91
+ "yargs": "^17.3.1"
88
92
  },
89
93
  "devDependencies": {
90
- "eslint": "^8.0.1",
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.2",
94
- "mocha": "^9.1.3",
95
- "prettier": "^2.4.1",
96
- "pretty-quick": "^3.1.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 { importGtfs, exportGtfs, getAgencies } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getAgencies } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getAttributions } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getBoardAlights } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getCalendarDates } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getCalendars } from '../../index.js';
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
- await closeDb();
21
+ const db = getDb(config);
22
+ await closeDb(db);
17
23
  });
18
24
 
19
25
  it('should return empty array if no calendars', async () => {
@@ -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 { importGtfs, getDb } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getDirections } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getFareAttributes } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getFareRules } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getFeedInfo } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getFrequencies } from '../../index.js';
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
- await closeDb();
21
+ const db = getDb(config);
22
+ await closeDb(db);
17
23
  });
18
24
 
19
25
  it('should return empty array if no frequencies', async () => {
@@ -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
- await closeDb();
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 { importGtfs, getPathways } from '../../index.js';
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
- await closeDb();
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 { importGtfs, getRideFeedInfos } from '../../index.js';
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
- await closeDb();
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 () => {