Skip to content

Commit d076093

Browse files
committed
The tests should implement the same code quality as the normal business code
1 parent 7d2a617 commit d076093

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"description": "A delightful way to building a RESTful API with NodeJs & TypeScript",
55
"main": "src/app.ts",
66
"scripts": {
7+
"pretest": "./node_modules/.bin/tslint -c ./tslint.json -t stylish './test/unit/**/*.ts'",
78
"test": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit",
8-
"test:pretty": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit --verbose",
9-
"test:coverage": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit --coverage",
9+
"test:pretty": "npm run test -- --verbose",
10+
"test:coverage": "npm run test -- --coverage",
11+
"pretest:black-box": "./node_modules/.bin/tslint -c ./tslint.json -t stylish './test/black-box/**/*.ts'",
1012
"test:black-box": "NODE_ENV=test ./node_modules/.bin/jest ./test/black-box -i",
11-
"test:black-box:pretty": "NODE_ENV=test ./node_modules/.bin/jest ./test/black-box -i --verbose",
13+
"test:black-box:pretty": "npm run test:black-box -- --verbose",
1214
"lint": "./node_modules/.bin/tslint -c ./tslint.json -p tsconfig.json 'src/**/*.ts' --format stylish",
1315
"build": "npm run lint && npm run clean:dist && npm run transpile && npm run copy:assets",
1416
"transpile": "./node_modules/.bin/tsc",

test/unit/api/middlewares/AuthenticateMiddleware.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { LogMock } from '../../lib/LogMock';
33

44
describe('AuthenticateMiddleware', () => {
55

6-
let authenticate, request, res, req, next;
6+
let authenticate;
7+
let request;
8+
let res;
9+
let req;
10+
let next;
711
beforeEach(() => {
812
process.env.AUTH0_HOST = 'test';
913
request = jest.fn();

test/unit/core/api/RequestBody.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('RequestBody', () => {
2121
});
2222
test('Should pass if no validators are defined', async () => {
2323
class TestBody extends RequestBody {
24-
@IsNotEmpty() value: string;
24+
@IsNotEmpty() public value: string;
2525
}
2626
const r = new TestBody();
2727
try {

test/unit/core/api/exceptionHandler.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { Exception } from '../../../../src/core/api/Exception';
44

55
describe('exceptionHandler', () => {
66

7-
let req, res, next;
7+
let req;
8+
let res;
9+
let next;
810
beforeEach(() => {
911
req = {};
1012
res = {

test/unit/core/api/extendExpressResponse.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { extendExpressResponse } from '../../../../src/core/api/extendExpressRes
33

44
describe('extendExpressResponse', () => {
55

6-
let req, res, next;
6+
let req;
7+
let res;
8+
let next;
79
beforeEach(() => {
810
req = {};
911
res = {

0 commit comments

Comments
 (0)