Course Highlights
  • Learn how to make unit tests
  • Learn how to make integration tests
  • Learn how to create a Express REST API from scratch
  • Learn how to build a Express REST API with test-driven development
  • Learn how to mock Mongoose models in Nodejs with Jest
  • Learn how to use Jest with TDD to build a REST API
  • Learn how to use MongoDB with Mongoose together with Jest tests
  • Learn how to write tests for error handling
Skills you will learn!
Curriculum

4 Topics
Initialising project
Hello World Express REST API in less than 5 mins!
CRUD Methods we are going to build the TDD-way in REST
Short intro to Jest + How to install Jest in our project

3 Topics
Our first test with Jest and Express REST API
Making our first test with Jest + Express REST API pass!
Make Jest run automatically on file changes

9 Topics
Defining a data model for our Todo items with Mongoose
Using jest.fn to mock our Mongoose model functions
Making our test with Jest mock model pass
How to configure Jest test environment
How to mock Request and Response objects in Express API
Writing test with mock Request object and making it pass!
Using beforeEach in Jest tests
Testing if response code is 201 and response is sent
Test if response is sending back JSON body

13 Topics
Creating our first integration test with Supertest and Jest
How to make our Express app ready for integration testing
Creating our Express Router
How to debug tests in Jest
Setting up Express JSON request body middleware
Fix for address already in use error
Making our controller function use async/await
Setting up our MongoDB database in the cloud!
Creating a MongoDB database user
Connect to MongoDB database with Mongoose
Modify our unit tests to use async/await
Creating a server.js for running our Express REST API manually
Manual Testing with Postman

8 Topics
Oops! We're missing error handling!
Unit tests for error handling
Making our error handling unit test PASS
Creating a integration test for error handling
Manual test for error handling
Making a test for errors returning JSON body
Create middleware to parse errors in JSON
Making all of our tests pass and final manual test!

7 Topics
Intro + first test exercise
Making first test for getTodos pass
Test if TodoModel.find is called
Test if response is being sent back correctly
Test for error handling
Integration test for GET /todos
Manual test with Postman

8 Topics
Intro + Getting first test done
Creating mock function TodoModel.findById and test for calls
Exercise! Make test for response and make test pass!
Solution to response testing with getById()
Error handling unit test
If TodoModel could not be found in database
Integration test for GET /todos/:todoId
404 Integration test + final manual tests

6 Topics
Intro to PUT method and first test
Test if TodoModel.findByIdAndUpdate is called
Test if PUT response is sent back
Test HTTP PUT error handling
HTTP PUT 404 test
HTTP PUT Integration test

4 Topics
Using Jest.mock instead of multiple Jest.fn + Intro to final challenge!
Unit tests for HTTP Delete method
Integration test for HTTP Delete Method + manual test + you are awesome!!
BONUS - coupons for other courses

  Write a Review

Nodejs Express - unit testing/integration tests with Jest

Go to Paid Course