Skip to content

Commit

Permalink
Add jest to start doing some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hagopj13 committed Nov 1, 2019
1 parent 006d34d commit aab7d9e
Show file tree
Hide file tree
Showing 6 changed files with 1,874 additions and 45 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"env": {
"node": true
"node": true,
"jest": true
},
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"extends": ["airbnb-base", "plugin:prettier/recommended", "plugin:jest/recommended"],
"parserOptions": {
"ecmaVersion": 2018
},
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ It comes with many built-in features, such as authentication using JWT, request
- [Express](http://expressjs.com)
- [MongoDB](https://www.mongodb.com) object data modeling using [Mongoose](https://mongoosejs.com)
- Authentication using [passport](http://www.passportjs.org) and role-based authorization
- Unit and integration tests using [Jest](https://jestjs.io/)
- Request data validation using [Joi](https://github.com/hapijs/joi)
- Advanced production process management using [PM2](https://pm2.keymetrics.io)
- Dependency management with [Yarn](https://yarnpkg.com)
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
testEnvironment: 'node',
restoreMocks: true,
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"scripts": {
"start": "pm2 start ecosystem.config.json --no-daemon",
"dev": "cross-env NODE_ENV=development nodemon src/index.js",
"test": "cross-env NODE_ENV=test jest tests -i",
"test:watch": "cross-env NODE_ENV=test jest tests -i --watchAll",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --check **/*.js",
Expand Down Expand Up @@ -39,8 +41,10 @@
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.2",
"eslint-plugin-prettier": "^3.1.1",
"husky": "^3.0.9",
"jest": "^24.9.0",
"lint-staged": "^9.4.2",
"nodemon": "^1.19.4",
"prettier": "^1.18.2"
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/auth.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('default test', () => {
expect(1 + 2).toBe(3);
});
Loading

0 comments on commit aab7d9e

Please sign in to comment.