Introduction

An up-to-date 2023 example of how you can use Mocha and Chai to perform API testing for a Node-ExpressJS-Mongoose app. You will be able to test your code locally and also automatically using Github Action.

Background info

What is Mongoose

MongooseJS provides a straight-forward solution to modeling your NodeJS application data easily in MongoDB. It handles all MongoDB validation, casting and business logic on your behalf.

What is Mocha

Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser. It is the test environment of choice for this project.

What is Chai

Chai is an assertion library for Node. Chai assertions and chai-http are used in Mocha to perform HTTP testing of the NodeJS API endpoints.