From 7c25f5ded6429580d7535c114d9a9431b56b319b Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Mon, 23 Apr 2018 01:36:52 +0100 Subject: Fix tests and add handy server scripts --- package.json | 7 ++++--- test/integration/protocol.routes.test.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 991305d..013556c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "index.ts", "license": "UNLICENSED", "scripts": { - "_test": "NODE_ENV='test' mocha --reporter spec -r ts-node/register", + "_test": "PORT=4321 NODE_ENV='test' mocha --reporter spec -r ts-node/register", "test": "yarn _test './test/**/*.test.ts'", "test:routes": "yarn _test './test/**/*.routes.test.ts'", "test:unit": "yarn _test './test/**/*.unit.test.ts'", @@ -14,11 +14,12 @@ "test:routes:protocol": "yarn _test './test/**/*protocol.routes.test.ts'", "docs": "typedoc --out 'docs' --readme 'README.md' --name 'St Andrews Junior Honours 2017/18 - Team BE4' --module commonjs --target ES6 --exclude '*.test.ts' --excludeExternals --includeDeclarations --ignoreCompilerErrors --disableOutputCheck 'src'", "run:postgres": "pg_ctl start", - "start": "ts-node src/index.ts", + "local": "ts-node src/index.ts", "_lint": "tslint -p './tsconfig.json' -c './tslint.json'", "lint": "yarn _lint --fix --force './src/**/*.ts'", "lint:tests": "yarn _lint --fix --force './test/**/*.ts'", - "serve": "pm2 restart ecosystem.config.js", + "start": "pm2 restart ecosystem.config.js", + "stop": "pm2 stop all", "console": "pm2 monit" }, "repository": { diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts index d60f844..77b39f0 100644 --- a/test/integration/protocol.routes.test.ts +++ b/test/integration/protocol.routes.test.ts @@ -232,7 +232,7 @@ describe('routes : protocol', () => { forEach(completeProtocol).it( '%s %s should be json', (method: string, path: string, temp: Template, resCode: number) => { - const request: ChaiHttp.Request = method === 'get' + const request: any = method === 'get' ? chai.request(app).get(base + path) : chai.request(app).post(base + path) .set('content-type', 'application/json').send(temp); @@ -263,7 +263,7 @@ describe('routes : protocol', () => { forEach(completeProtocol).it( '%s %s should conform to the general response template', (method: string, path: string, temp: Template, resCode: number) => { - const request: ChaiHttp.Request = method === 'get' + const request: any = method === 'get' ? chai.request(app).get(base + path) : chai.request(app).post(base + path).send(temp);; request.set('Authorization', `Bearer ${token}`); -- cgit v1.2.1