gtfs 3.1.4 → 3.2.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.
Files changed (73) 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 +12 -0
  5. package/README.md +54 -22
  6. package/docs/images/node-gtfs-logo.svg +18 -0
  7. package/lib/db.js +62 -13
  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 +3 -3
  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/package.json +14 -10
  41. package/test/mocha/export-gtfs.js +11 -4
  42. package/test/mocha/get-agencies.js +9 -3
  43. package/test/mocha/get-attributions.js +9 -3
  44. package/test/mocha/get-board-alights.js +9 -3
  45. package/test/mocha/get-calendar-dates.js +9 -3
  46. package/test/mocha/get-calendars.js +9 -3
  47. package/test/mocha/get-db.js +62 -3
  48. package/test/mocha/get-directions.js +9 -3
  49. package/test/mocha/get-fare-attributes.js +9 -3
  50. package/test/mocha/get-fare-rules.js +9 -3
  51. package/test/mocha/get-feed-info.js +9 -3
  52. package/test/mocha/get-frequencies.js +9 -3
  53. package/test/mocha/get-levels.js +3 -3
  54. package/test/mocha/get-pathways.js +9 -3
  55. package/test/mocha/get-ride-feed-infos.js +9 -3
  56. package/test/mocha/get-rider-trips.js +9 -3
  57. package/test/mocha/get-riderships.js +9 -3
  58. package/test/mocha/get-routes.js +3 -3
  59. package/test/mocha/get-shapes-as-geojson.js +9 -3
  60. package/test/mocha/get-shapes.js +3 -3
  61. package/test/mocha/get-stop-attributes.js +9 -3
  62. package/test/mocha/get-stops-as-geojson.js +9 -3
  63. package/test/mocha/get-stops.js +3 -3
  64. package/test/mocha/get-stoptimes.js +9 -3
  65. package/test/mocha/get-timetable-pages.js +9 -3
  66. package/test/mocha/get-timetable-stop-orders.js +9 -3
  67. package/test/mocha/get-timetables.js +9 -3
  68. package/test/mocha/get-transfers.js +9 -3
  69. package/test/mocha/get-translations.js +9 -3
  70. package/test/mocha/get-trip-capacities.js +9 -3
  71. package/test/mocha/get-trips.js +3 -3
  72. package/test/mocha/import-gtfs.js +4 -4
  73. package/.prettierrc.js +0 -4
@@ -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 () => {
@@ -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, getRiderTrips } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getRiderTrips,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getRiderTrips():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getRiderTrips():', () => {
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 rider trips (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, getRiderships } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getRiderships,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getRiderships():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getRiderships():', () => {
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 riderships (GTFS-ride)', 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, getRoutes } from '../../index.js';
6
+ import { openDb, getDb, closeDb, importGtfs, getRoutes } from '../../index.js';
8
7
 
9
8
  describe('getRoutes():', () => {
10
9
  before(async () => {
@@ -13,7 +12,8 @@ describe('getRoutes():', () => {
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 routes for given agency 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, getShapesAsGeoJSON } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getShapesAsGeoJSON,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getShapesAsGeoJSON():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getShapesAsGeoJSON():', () => {
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 geojson with an empty features array if no shapes exist', 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, getShapes } from '../../index.js';
6
+ import { openDb, getDb, closeDb, importGtfs, getShapes } from '../../index.js';
8
7
 
9
8
  describe('getShapes():', () => {
10
9
  before(async () => {
@@ -13,7 +12,8 @@ describe('getShapes():', () => {
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 an empty array if no shapes 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, getStopAttributes } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getStopAttributes,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getStopAttributes():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getStopAttributes():', () => {
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 stop 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, getStopsAsGeoJSON } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getStopsAsGeoJSON,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getStopsAsGeoJSON(): ', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getStopsAsGeoJSON(): ', () => {
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 geojson with an empty features array if no stops exist', 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, getStops } from '../../index.js';
6
+ import { openDb, getDb, closeDb, importGtfs, getStops } from '../../index.js';
8
7
 
9
8
  describe('getStops():', () => {
10
9
  before(async () => {
@@ -13,7 +12,8 @@ describe('getStops():', () => {
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 an empty array if no stops 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, getStoptimes } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getStoptimes,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getStoptimes():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getStoptimes():', () => {
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 an empty array if no stoptimes exist for given agency', 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, getTimetablePages } from '../../index.js';
6
+ import {
7
+ openDb,
8
+ getDb,
9
+ closeDb,
10
+ importGtfs,
11
+ getTimetablePages,
12
+ } from '../../index.js';
8
13
 
9
14
  describe('getTimetablePages():', () => {
10
15
  before(async () => {
@@ -13,7 +18,8 @@ describe('getTimetablePages():', () => {
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 timetable pages (GTFS-to-HTML timetables)', async () => {