This example is for the STSWENG course to illustrate how to mock the database connection with mongodb and mongoose. The example was based on this example from Talha Awan.
Alternatively, mongoose can also be mocked using mockingoose.
- NodeJS & npm
- MongoDB Community Edition (Must be running in the background)
- Postman - To be able to test the endpoints
- Any text editor for JavaScript, HTML & CSS (VSCode, Atom, SublimeText, etc.)
- Fork this repository by clicking the Fork button up at the top of this page.
- Clone your copy of the repository
git clone https://github.com/<YOUR_USERNAME>/node-unit-mvc.git
- Navigate to the directory:
cd node-unit-mvc - Install the dependencies:
npm install
Note: The only script set up for this project is the npm run test which will run jest.
The post.test.js file will be built up during the class.