Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
horia141 committed Jul 8, 2018
1 parent 1650e5e commit 0c21ce1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/config.ts
@@ -1,4 +1,4 @@
import { Module, Global } from "@nestjs/common";
import { Global, Module } from "@nestjs/common";
import * as dotenv from "dotenv";
import * as fs from "fs";

Expand Down Expand Up @@ -33,7 +33,11 @@ export class ConfigService {

public get port(): number {
// tslint:disable:no-string-literal
return parseInt(this.envConfig["PORT"], 10);
const port = parseInt(this.envConfig["PORT"], 10);
if (!Number.isSafeInteger(port)) {
throw new Error(`Invalid port value ${this.envConfig["PORT"]}`);
}
return port;
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/config-test.ts
Expand Up @@ -32,7 +32,7 @@ PORT=10001
it("can be constructed for testing", () => {
const configService = ConfigService.forTesting();

expect(() => configService.env).to.throw;
expect(() => configService.port).to.throw;
expect(() => configService.env).to.throw();
expect(() => configService.port).to.throw();
});
});

0 comments on commit 0c21ce1

Please sign in to comment.