A simple demo showing how to contruct your Node.js models using Mongoose for testing with Mocha.js.
I don't want to say this is the holy grail for declaring your models with Node.js for testing with Mocha.js. But after reading and testing a lot myself I feel like it's a pretty efficient solution to the problem. Besides, it's a good placeholder for myself to learn and experiment more.
- git clone https://github.com/joshmosh/node-mongoose-mocha-demo.git
- node-mongoose-mocha-demo
- npm install
After you have the repository cloned and all node modules installed, take a peep at the code in both the models folder and test folder. I have put comments in the code explaining what is going on. To actually run the test and see a sample output of the Mocha.js test results type: npm test
That's it!