Skip to content

Commit 7bcbd38

Browse files
committedSep 3, 2018
update tests
1 parent cf39a25 commit 7bcbd38

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed
 

‎bin/ssim2gtfs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env node
2-
require("../dist/cli.js");
2+
require("../dist/src/cli.js");

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ssim2gtfs",
3-
"version": "0.1.0",
3+
"version": "0.1.2",
44
"description": "SSIM to GTFS conversion tool",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"start": "ts-node src/cli.ts",
1212
"prepublishOnly": "tsc -p ./ --outDir dist/",
13-
"test": "npm run lint && mocha --compilers ts:ts-node/register 'test/**/*.spec.ts'",
13+
"test": "npm run lint && mocha --require ts-node/register 'test/**/*.spec.ts'",
1414
"lint-raw": "tslint --project tsconfig.json",
1515
"lint": "npm run lint-raw -- -t stylish"
1616
},

‎src/converter/Converter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ export class Converter {
5858

5959
function streamToString(stream: Transform): Promise<string> {
6060
return new Promise<string>((resolve, reject) => {
61-
let string = "";
61+
let result = "";
6262

63-
stream.on("data", data => string += data);
64-
stream.on("end", () => resolve(string));
63+
stream.on("data", data => result += data);
64+
stream.on("end", () => resolve(result));
6565
stream.on("error", reject);
6666
});
6767
}

‎src/gtfs/CalendarStream.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class CalendarStream extends GTFSFileStream {
3030
this.datesSeen[calendarId] = this.currentId++;
3131
}
3232

33-
return this.datesSeen[calendarId]
33+
return this.datesSeen[calendarId];
3434
}
3535

3636
public getCalendarId(schedule: FlightSchedule): string {

‎src/ssim/SSIMStream.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export class SSIMStream extends Transform {
5353
private setSeason(season: string, year: string): void {
5454
const summerStartDate = this.findSunday(LocalDate.parse("20" + year + "-03-31"));
5555
const winterStartDate = this.findSunday(LocalDate.parse("20" + year + "-10-31"));
56-
const summerStart = summerStartDate.toString().substr(8, 2)+ "MAR";
57-
const winterStart = winterStartDate.toString().substr(8, 2)+ "OCT";
56+
const summerStart = summerStartDate.toString().substr(8, 2) + "MAR";
57+
const winterStart = winterStartDate.toString().substr(8, 2) + "OCT";
5858

5959
if (season === Season.Summer) {
6060
this.firstDateOfSeason = summerStart + year;

‎test/ssim/SSIMStream.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ describe("SSIMStream", () => {
9494
});
9595

9696
xit("dates apply to scheduled departure time, not passenger departure time", () => {
97+
const ssim = new SSIMStream({ objectMode: true });
98+
99+
ssim.write("3 CA 1011501J26OCT0826OCT081234567 ___22001100-08003 ___04000400+00001 738CDIJYBMHKLQGSXVUZWTE XX II M 00000073", "utf8");
100+
101+
return awaitStream(ssim, (schedule: FlightSchedule) => {
102+
chai.expect(schedule.departureTime).to.equal("22:00");
103+
chai.expect(schedule.arrivalTime).to.equal("28:00");
104+
});
97105
});
98106

99107
});

‎tslint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"jsx-no-lambda": false,
2222
"jsx-no-multiline-js": false,
2323
"label-position": true,
24-
"max-line-length": [ true, 120 ],
24+
"max-line-length": false,
2525
"member-ordering": false,
2626
"no-any": false,
2727
"no-arg": true,

0 commit comments

Comments
 (0)