Skip to content

Commit

Permalink
adding mocha tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lionphilips committed Feb 21, 2018
1 parent 3dee426 commit 3dc5fd7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This scaffold uses a number of open source projects to work properly:
* [JWT Auth](http://mongoosejs.com/) - JsonWebToken implementation for node.js
* [Sengrid](https://sendgrid.com) - Allows to quickly and easily send emails through SendGrid using nodejs.
* [apiDoc](http://apidocjs.com/) - Inline Documentation for RESTful web APIs
* [Mocha](https://mochajs.org/) - simple, flexible, fun javascript test framework for node.js

### Installation

Expand All @@ -41,6 +42,14 @@ $ npm install
$ node www/server
```

### Testing

You need to edit the test config file **test/config** and run:

```sh
$ npm test
```

### Documentation

You can see the API documentation on **doc/** folder. If you want to re-generate the documentation, you need to run this comand:
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "This project is an initial NodeJS Rest API scaffold for developers",
"main": "src/app.js",
"scripts": {
"start": "node www/server"
"start": "node www/server",
"test": "node_modules/mocha/bin/mocha"
},
"keywords": [
"nodejs",
Expand All @@ -19,16 +20,20 @@
"dependencies": {
"@sendgrid/mail": "^6.2.1",
"body-parser": "^1.18.2",
"chai": "^4.1.2",
"debug": "^3.1.0",
"express": "^4.16.2",
"guid": "0.0.12",
"http": "0.0.0",
"jsonwebtoken": "^7.4.0",
"md5": "^2.2.1",
"mongoose": "^5.0.6"
"mocha": "^5.0.1",
"mongoose": "^5.0.6",
"should": "^13.2.1"
},
"devDependencies": {
"apidoc": "^0.17.6",
"nodemon": "^1.15.0"
"nodemon": "^1.15.0",
"request": "^2.83.0"
}
}
5 changes: 3 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
global.PROJECT_NAME = 'REST API';
global.PROJECT_URL = 'http://localhost:3000';
global.PROJECT_VERSION = '0.0.1';
global.SALT_KEY = ''; //important
global.SALT_KEY = 'e8ccfba6-f087-4697-a567-2ee41e6b6697'; //important

module.exports = {
MODE: 'development', // production or development
CONNECTION_STRING: '', //mongodb connection string (required)
CONNECTION_STRING: 'mongodb://luis:[email protected]:58048/nodestr', //mongodb connection string (required)
SENDGRID_API_KEY: '', //sendgrid api key (optional)
SENDGRID_MAILER: '' // who is sending the emails (optional)
};

0 comments on commit 3dc5fd7

Please sign in to comment.