Skip to content

Commit d282861

Browse files
committed
Extend test coverage
1 parent c440b9f commit d282861

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/Gtfsrt2LC.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Gtfsrt2LC {
150150

151151
// Check if this is a new update based on recorded Connections history (if any)
152152
// and skip it if is not new.
153-
if (this.historyDB && !(await this.differentiaUpdate({
153+
if (this.historyDB && !(await this.differentialUpdate({
154154
route: r,
155155
trip: t,
156156
stopTimes: st,
@@ -626,7 +626,7 @@ class Gtfsrt2LC {
626626
return update;
627627
}
628628

629-
async differentiaUpdate(params) {
629+
async differentialUpdate(params) {
630630
const {
631631
route,
632632
trip,

test/gtfsrt2lc.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,4 +582,19 @@ test('Cover GtfsIndex functions', async () => {
582582
try {
583583
await gti.getIndexes();
584584
} catch (err) { }
585+
});
586+
587+
test('Cover Gtfsrt2LC functions', async () => {
588+
grt = new Gtfsrt2lc({ path: rt_path, uris: mock_uris, headers: {} });
589+
// Test for resolveScheduleRelationship
590+
const notAvailable = grt.resolveScheduleRelationship(1, 1);
591+
const mustPhone = grt.resolveScheduleRelationship(0, 2);
592+
const mustCoordinate = grt.resolveScheduleRelationship(0, 3);
593+
// Test for getting headers
594+
const headers = grt.headers();
595+
596+
expect(notAvailable).toBe('gtfs:NotAvailable');
597+
expect(mustPhone).toBe('gtfs:MustPhone');
598+
expect(mustCoordinate).toBe('gtfs:MustCoordinateWithDriver');
599+
expect(headers).toBeDefined();
585600
});

0 commit comments

Comments
 (0)