Skip to content

jagreehal/nodejs-api-testing-examples

Repository files navigation

Nodejs API test examples

Examples of how to test a Node.js API that makes backend calls to external services.

e.g. browser -> [API -> external service]

Testing Examples

There are examples for running tests using Jest, Nock and Playwright.

TL;DR

Playwright alone can't be used as they test at the browser level and so cannot intercept calls node from the backend.

So you're left with two options:

  1. Jest mock the module making the backend calls

  2. Use a tool like msw to mock the backend calls

Tests so from

At the moment the examples show mocking calls made to the Pokemon API

About

Examples of how to test node.js APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors