Skip to content

Commit 1ae1058

Browse files
committed
Increase test coverage + configure dependabot
1 parent 16acfb4 commit 1ae1058

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
# Check for updates once a week
7+
interval: "weekly"
8+
# Raise pull requests for version updates against the `development` branch
9+
target-branch: "development"
10+
# Labels on pull requests for security and version updates
11+
labels:
12+
- "npm dependencies"

test/gtfsrt2lc.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require('fs');
22
const del = require('del');
3+
const { Readable } = require('stream');
34
const uri_templates = require('uri-templates');
45
const GtfsIndex = require('../lib/GtfsIndex');
56
const Gtfsrt2lc = require('../lib/Gtfsrt2LC');
@@ -629,6 +630,28 @@ test('Missing index throws exception', async () => {
629630
expect(failed).toBeDefined()
630631
});
631632

633+
test('Cover Gtfsrt2LC functions', async () => {
634+
const gtfsrt2lc = new Gtfsrt2lc({});
635+
let fail = null;
636+
637+
try {
638+
await gtfsrt2lc.handleResponse({ statusCode: 401 });
639+
} catch (err) {
640+
fail = err;
641+
}
642+
expect(fail).toBeDefined();
643+
644+
const readStream = new Readable({ objectMode: true, read() {}});
645+
gtfsrt2lc.handleResponse({
646+
statusCode: 200,
647+
headers: { 'content-encoding': 'fake-format' },
648+
body: Promise.resolve(readStream)
649+
}).then(result => {
650+
expect(result).toBe(false);
651+
});
652+
readStream.push(null);
653+
});
654+
632655
test('Cover GtfsIndex functions', async () => {
633656
let gti = new GtfsIndex({ path: 'https://gtfs.irail.be/nmbs/gtfs/latest.zip' });
634657
try {

0 commit comments

Comments
 (0)