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
|
@@ -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
|
-
getDirections,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getDirections } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getDirections():', () => {
|
|
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 directions',
|
|
19
|
+
it('should return empty array if no directions', () => {
|
|
26
20
|
const fareRouteId = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getDirections({
|
|
29
23
|
route_id: fareRouteId,
|
|
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
|
-
getFareAttributes,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFareAttributes } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getFareAttributes():', () => {
|
|
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 fare_attributes',
|
|
19
|
+
it('should return empty array if no fare_attributes', () => {
|
|
26
20
|
const fareId = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getFareAttributes({
|
|
29
23
|
fare_id: fareId,
|
|
30
24
|
});
|
|
31
25
|
|
|
@@ -33,10 +27,10 @@ describe('getFareAttributes():', () => {
|
|
|
33
27
|
results.should.have.length(0);
|
|
34
28
|
});
|
|
35
29
|
|
|
36
|
-
it('should return expected fare_attributes',
|
|
30
|
+
it('should return expected fare_attributes', () => {
|
|
37
31
|
const fareId = 'OW_1_20160228';
|
|
38
32
|
|
|
39
|
-
const results =
|
|
33
|
+
const results = getFareAttributes({
|
|
40
34
|
fare_id: fareId,
|
|
41
35
|
});
|
|
42
36
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
|
|
3
|
+
import should from 'should';
|
|
4
|
+
|
|
5
|
+
import config from '../test-config.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFareLegRules } from '../../index.js';
|
|
7
|
+
|
|
8
|
+
describe('getFareLegRules():', () => {
|
|
9
|
+
before(async () => {
|
|
10
|
+
openDb(config);
|
|
11
|
+
await importGtfs(config);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should return empty array if no fare_leg_rules exist', () => {
|
|
20
|
+
const legGroupId = 'fake-leg-group-id';
|
|
21
|
+
const results = getFareLegRules({
|
|
22
|
+
leg_group_id: legGroupId,
|
|
23
|
+
});
|
|
24
|
+
should.exists(results);
|
|
25
|
+
results.should.have.length(0);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
|
|
3
|
+
import should from 'should';
|
|
4
|
+
|
|
5
|
+
import config from '../test-config.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFareProducts } from '../../index.js';
|
|
7
|
+
|
|
8
|
+
describe('getFareProducts():', () => {
|
|
9
|
+
before(async () => {
|
|
10
|
+
openDb(config);
|
|
11
|
+
await importGtfs(config);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
after(() => {
|
|
15
|
+
const db = openDb(config);
|
|
16
|
+
closeDb(db);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should return empty array if no fare_products exist', () => {
|
|
20
|
+
const fareProductId = 'fake-fare-product-id';
|
|
21
|
+
const results = getFareProducts({
|
|
22
|
+
fare_product_id: fareProductId,
|
|
23
|
+
});
|
|
24
|
+
should.exists(results);
|
|
25
|
+
results.should.have.length(0);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -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
|
-
getFareRules,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFareRules } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getFareRules():', () => {
|
|
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 fare_rules',
|
|
19
|
+
it('should return empty array if no fare_rules', () => {
|
|
26
20
|
const routeId = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getFareRules({
|
|
29
23
|
route_id: routeId,
|
|
30
24
|
});
|
|
31
25
|
should.exists(results);
|
|
32
26
|
results.should.have.length(0);
|
|
33
27
|
});
|
|
34
28
|
|
|
35
|
-
it('should return expected fare_rules',
|
|
29
|
+
it('should return expected fare_rules', () => {
|
|
36
30
|
const routeId = 'Bu-16APR';
|
|
37
31
|
|
|
38
|
-
const results =
|
|
32
|
+
const results = getFareRules(
|
|
39
33
|
{
|
|
40
34
|
route_id: routeId,
|
|
41
35
|
},
|
|
@@ -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
|
-
getFeedInfo,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFeedInfo } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getFeedInfo():', () => {
|
|
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 feed info',
|
|
19
|
+
it('should return empty array if no feed info', () => {
|
|
26
20
|
const feedPublisherName = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getFeedInfo({
|
|
29
23
|
feed_publisher_name: feedPublisherName,
|
|
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
|
-
getFrequencies,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getFrequencies } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getFrequencies():', () => {
|
|
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 frequencies',
|
|
19
|
+
it('should return empty array if no frequencies', () => {
|
|
26
20
|
const tripId = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getFrequencies({
|
|
29
23
|
trip_id: tripId,
|
|
30
24
|
});
|
|
31
25
|
should.exists(results);
|
package/test/mocha/get-levels.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
import should from 'should';
|
|
4
4
|
|
|
5
5
|
import config from '../test-config.js';
|
|
6
|
-
import { openDb,
|
|
6
|
+
import { openDb, closeDb, importGtfs, getLevels } from '../../index.js';
|
|
7
7
|
|
|
8
8
|
describe('getLevels():', () => {
|
|
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 levels',
|
|
19
|
+
it('should return empty array if no levels', () => {
|
|
20
20
|
const levelId = 'not_real';
|
|
21
21
|
|
|
22
|
-
const results =
|
|
22
|
+
const results = getLevels({
|
|
23
23
|
level_id: levelId,
|
|
24
24
|
});
|
|
25
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
|
-
getPathways,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getPathways } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getPathways():', () => {
|
|
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 pathways',
|
|
19
|
+
it('should return empty array if no pathways', () => {
|
|
26
20
|
const pathwayId = 'not_real';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getPathways({
|
|
29
23
|
pathway_id: pathwayId,
|
|
30
24
|
});
|
|
31
25
|
should.exists(results);
|
|
@@ -3,27 +3,21 @@
|
|
|
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
|
-
getRideFeedInfos,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getRideFeedInfos } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getRideFeedInfos():', () => {
|
|
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 ride-feed-infos (GTFS-ride)',
|
|
26
|
-
const results =
|
|
19
|
+
it('should return empty array if no ride-feed-infos (GTFS-ride)', () => {
|
|
20
|
+
const results = getRideFeedInfos({});
|
|
27
21
|
should.exists(results);
|
|
28
22
|
results.should.have.length(0);
|
|
29
23
|
});
|
|
@@ -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
|
-
getRiderTrips,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getRiderTrips } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getRiderTrips():', () => {
|
|
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 rider trips (GTFS-ride)',
|
|
19
|
+
it('should return empty array if no rider trips (GTFS-ride)', () => {
|
|
26
20
|
const tripId = 'fake-trip-id';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getRiderTrips({
|
|
29
23
|
trip_id: tripId,
|
|
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
|
-
getRiderships,
|
|
12
|
-
} from '../../index.js';
|
|
6
|
+
import { openDb, closeDb, importGtfs, getRiderships } from '../../index.js';
|
|
13
7
|
|
|
14
8
|
describe('getRiderships():', () => {
|
|
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 riderships (GTFS-ride)',
|
|
19
|
+
it('should return empty array if no riderships (GTFS-ride)', () => {
|
|
26
20
|
const routeId = 'fake-route-id';
|
|
27
21
|
|
|
28
|
-
const results =
|
|
22
|
+
const results = getRiderships({
|
|
29
23
|
route_id: routeId,
|
|
30
24
|
});
|
|
31
25
|
should.exists(results);
|
package/test/mocha/get-routes.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, getRoutes } from '../../index.js';
|
|
7
7
|
|
|
8
8
|
describe('getRoutes():', () => {
|
|
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 routes for given agency exist',
|
|
19
|
+
it('should return empty array if no routes for given agency exist', () => {
|
|
20
20
|
const routeId = 'fake-route-id';
|
|
21
21
|
|
|
22
|
-
const results =
|
|
22
|
+
const results = getRoutes({
|
|
23
23
|
route_id: routeId,
|
|
24
24
|
});
|
|
25
25
|
should.exists(results);
|
|
26
26
|
results.should.have.length(0);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('should return expected routes',
|
|
30
|
-
const results =
|
|
29
|
+
it('should return expected routes', () => {
|
|
30
|
+
const results = getRoutes({}, [], [['route_long_name', 'ASC']]);
|
|
31
31
|
|
|
32
32
|
const expectedResults = [
|
|
33
33
|
{
|
|
@@ -97,8 +97,8 @@ describe('getRoutes():', () => {
|
|
|
97
97
|
expectedResults.should.match(results);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
it('should return expected routes for a specific stop_id',
|
|
101
|
-
const results =
|
|
100
|
+
it('should return expected routes for a specific stop_id', () => {
|
|
101
|
+
const results = getRoutes(
|
|
102
102
|
{ stop_id: '70321' },
|
|
103
103
|
[],
|
|
104
104
|
[['route_long_name', 'ASC']]
|
|
@@ -127,8 +127,8 @@ describe('getRoutes():', () => {
|
|
|
127
127
|
expectedResults.should.match(results);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('should return no routes for a invalid stop_id',
|
|
131
|
-
const results =
|
|
130
|
+
it('should return no routes for a invalid stop_id', () => {
|
|
131
|
+
const results = getRoutes(
|
|
132
132
|
{ stop_id: 'not-valid' },
|
|
133
133
|
[],
|
|
134
134
|
[['route_long_name', 'ASC']]
|
|
@@ -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
|
-
|
|
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 geojson with an empty features array if no shapes exist',
|
|
24
|
+
it('should return geojson with an empty features array if no shapes exist', () => {
|
|
26
25
|
const shapeId = 'fake-shape-id';
|
|
27
|
-
const geojson =
|
|
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',
|
|
37
|
-
const geojson =
|
|
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',
|
|
46
|
+
it('should return geojson with shapes for a specific routeId', () => {
|
|
48
47
|
const routeId = 'Lo-16APR';
|
|
49
48
|
|
|
50
|
-
const geojson =
|
|
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',
|
|
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 =
|
|
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',
|
|
78
|
+
it('should return geojson with shapes for a specific shapeId', () => {
|
|
80
79
|
const shapeId = 'cal_sf_tam';
|
|
81
80
|
|
|
82
|
-
const geojson =
|
|
81
|
+
const geojson = getShapesAsGeoJSON({
|
|
83
82
|
shape_id: shapeId,
|
|
84
83
|
});
|
|
85
84
|
|