iDLEWINK / node-unit-mvc

Unit testing using express and mongoose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit Testing Example with Jest and Sinon

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.

Requirements

Pre-Setup

  1. Fork this repository by clicking the Fork button up at the top of this page.
  2. Clone your copy of the repository git clone https://github.com/<YOUR_USERNAME>/node-unit-mvc.git

Running locally

  1. Navigate to the directory: cd node-unit-mvc
  2. Install the dependencies: npm install

Note: The only script set up for this project is the npm run test which will run jest.

Setting up the test

The post.test.js file will be built up during the class.

About

Unit testing using express and mongoose


Languages

Language:JavaScript 100.0%