aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--src/app.ts11
-rw-r--r--src/matcher/options.unit.test.ts (renamed from src/matcher/options.test.ts)0
-rw-r--r--src/matcher/types.unit.test.ts (renamed from src/matcher/types.test.ts)0
-rw-r--r--test/protocol.node.test.ts (renamed from test/nodeserver.test.ts)4
5 files changed, 13 insertions, 4 deletions
diff --git a/package.json b/package.json
index 559efc7..15615c0 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,8 @@
"license": "UNLICENSED",
"scripts": {
"test": "mocha --reporter spec -r ts-node/register './**/*.test.ts'",
+ "test_unit": "mocha --reporter spec -r ts-node/register './**/*.unit.test.ts'",
+ "test_node": "mocha --reporter spec -r ts-node/register './**/*.node.test.ts'",
"docs": "typedoc --out 'docs' --readme 'README.md' --name 'St Andrews Junior Honours 2017/18 - Team BE4' --module commonjs --target ES5 --exclude '*.test.ts' --includeDeclarations --excludeExternals 'src'",
"start": "ts-node src/index.ts",
"lint": "tslint --fix --force -p './tsconfig.json'",
diff --git a/src/app.ts b/src/app.ts
index 4f0e0d7..ef4485e 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -5,17 +5,19 @@ import * as logger from 'morgan';
class App {
public express: ex.Express;
- public logEnabled: boolean = true;
+ private logEnabled: boolean;
- public constructor() {
+ public constructor(enableLog: boolean) {
this.express = ex();
this.middleware();
this.mountRoutes();
+ this.logEnabled = enableLog;
}
// Configure Express middleware.
private middleware(): void {
if (this.logEnabled) {
+ console.log("log enabled")
this.express.use(logger('combined'));
}
this.express.use(bodyParser.json());
@@ -36,4 +38,7 @@ class App {
}
}
-export default new App().express;
+export default new App(true).express;
+export function TestApp(){
+ return new App(false).express;
+}
diff --git a/src/matcher/options.test.ts b/src/matcher/options.unit.test.ts
index ff5763e..ff5763e 100644
--- a/src/matcher/options.test.ts
+++ b/src/matcher/options.unit.test.ts
diff --git a/src/matcher/types.test.ts b/src/matcher/types.unit.test.ts
index 398064c..398064c 100644
--- a/src/matcher/types.test.ts
+++ b/src/matcher/types.unit.test.ts
diff --git a/test/nodeserver.test.ts b/test/protocol.node.test.ts
index a15eee4..1c89b9e 100644
--- a/test/nodeserver.test.ts
+++ b/test/protocol.node.test.ts
@@ -22,7 +22,9 @@ import { Template, alternative, array, exact, match, optional
} from '../src/matcher/options';
import { default as types } from '../src/matcher/types';
-import app from '../src/app';
+import * as App from '../src/app';
+let app = App.TestApp();
+
const responseTemplate: Template = {
status: types.string,