Test Express HTTP Endpoints with Supertest and node:test

https://leanpub.com/node-and-express-simplified

What’s the Difference Between a Test Runner and an HTTP Testing Tool?

https://leanpub.com/node-and-express-simplified

Create a Project Directory

https://leanpub.com/node-and-express-simplified

Create a package.json File

https://leanpub.com/node-and-express-simplified

Configure the Project as an ES Module Application

https://leanpub.com/node-and-express-simplified

Install Express

https://leanpub.com/node-and-express-simplified

Install the HTTP Testing Library

https://leanpub.com/node-and-express-simplified

Test HTTP Requests

https://leanpub.com/node-and-express-simplified

Run the App Script

https://leanpub.com/node-and-express-simplified

Use the node:test Module to Run Tests

https://leanpub.com/node-and-express-simplified

Create the route file

https://leanpub.com/node-and-express-simplified

Create the app’s test script

https://leanpub.com/node-and-express-simplified

Write the test case

https://leanpub.com/node-and-express-simplified

Update the app.js script

https://leanpub.com/node-and-express-simplified

Run the test

https://leanpub.com/node-and-express-simplified

Configure the App’s Web Server

https://leanpub.com/node-and-express-simplified

Run the Express.js Web Server

https://leanpub.com/node-and-express-simplified

Important Things to Know about Testing HTTP Endpoints

https://leanpub.com/node-and-express-simplified

Expectations run in the order of definition

https://leanpub.com/node-and-express-simplified

Supertest requests support promises

https://leanpub.com/node-and-express-simplified

expect() calls accept the done callback

https://leanpub.com/node-and-express-simplified

expect()’s behavior depends on its arguments

https://leanpub.com/node-and-express-simplified

The optionalEndFunction callback sends an HTTP request

https://leanpub.com/node-and-express-simplified