RANIARANIA Academy

Testing Node Applications

Test a Node API with confidence using Jest and supertest — write fast unit tests, integration-test HTTP endpoints, handle asynchronous code correctly, and isolate collaborators with mocks and fixtures. You will finish able to drive an API route through a red-green-refactor cycle and read coverage honestly.

Watch the free preview

Why test, and getting Jest running — free to watch, no account needed.

Node.js ADVANCED · 150 min · Certificate on completion · 3 CPD points

What you'll learn

  • Test a Node API with confidence using Jest and supertest
  • Write and organise unit tests with describe, test, expect and the right matchers
  • Test asynchronous code correctly with promises and async/await
  • Integration-test HTTP endpoints and isolate collaborators with mocks and fixtures
  • Drive an API route through a red-green-refactor TDD cycle and read coverage honestly

Syllabus

Jest Fundamentals — the Testing Toolkit
Why test, and getting Jest runningFree preview15 min
describe, test, expect and choosing matchers15 min
Unit Testing & Testing Async Code
Unit testing pure functions and modules15 min
Testing asynchronous code correctly15 min
Integration Testing HTTP APIs
Supertest — testing Express endpoints15 min
Mocks, spies and fixtures15 min
Coverage & the TDD Workflow
Coverage and what it really tells you15 min
Red-green-refactor on an API route15 min
Lab — 10 Exercises & Solutions
Exercises 1–515 min
Exercises 6–1015 min