Skip to content
This repository was archived by the owner on Jan 20, 2020. It is now read-only.

Commit cc8b1c2

Browse files
author
Luciano Nooijen
committed
Feedback from Jeroen
1 parent 9b3ad96 commit cc8b1c2

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodejs-blog",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "A blog API built in NodeJS that can be used as a standalone application, or included in a NodeJS application",
55
"main": "index.js",
66
"author": "Luciano Nooijen <[email protected]> (https://bytecode.nl)",
@@ -31,9 +31,9 @@
3131
"lint": "yarn run lint:js && yarn run lint:ts",
3232
"lint:js": "eslint --ext .js,.jsx .",
3333
"lint:ts": "tslint --project .",
34-
"test": "NODE_ENV=test jest -i",
34+
"test": "NODE_ENV=test jest -i --forceExit",
3535
"test:watch": "NODE_ENV=test jest -i --watch",
36-
"coverage": "NODE_ENV=test jest -i --coverage",
36+
"coverage": "NODE_ENV=test jest -i --coverage --forceExit",
3737
"migrate": "knex migrate:latest",
3838
"reinstall": "rm -rf node_modules && yarn",
3939
"clean": "rm -rf dist build coverage"

tests/controllers/categories.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useTestDatabase } from '../config/index';
22
import blog from '../config/blog';
33

4-
const { authHelper } = require('../../helpers');
5-
64
const {
75
listCategories,
86
getCategory,

tests/helpers/auth-helper.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ describe('Authentication helper', () => {
4646
});
4747

4848
test('decodeJWT should return the correct payload', () => {
49-
const payload = authHelper.generatePayload(payloadData);
5049
const authToken = authHelper.generateJWT(payloadData);
5150
const decodedPayload = authHelper.decodeJWT(authToken);
52-
// expect(decodedPayload).toEqual(payload); // Flaky
5351
expect(decodedPayload.data).toEqual(payloadData);
5452
});
5553

tests/index.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useTestDatabase } from './config/index';
2+
13
const nodeBlog = require('../');
24
const { authors, auth, users, categories, articles } = require('../');
35

@@ -8,9 +10,18 @@ const database = process.env.DB_NAME_TEST;
810
const password = process.env.DB_PASS_TEST;
911
const debug = process.env.KNEX_DEBUG === 'true';
1012

11-
const nodeBlogArguments = { client, host, user, database, password, debug };
13+
const nodeBlogArguments = {
14+
client,
15+
host,
16+
user,
17+
database,
18+
password,
19+
debug,
20+
};
1221
const blog = nodeBlog(client, host, user, database, password, debug);
1322

23+
useTestDatabase();
24+
1425
describe('NodeBlog NPM module', () => {
1526
test('NodeBlog to create a knex instance', () => {
1627
expect(typeof blog).toBe('function');

0 commit comments

Comments
 (0)