# Testing an API End to End

Testing an API End to End: Testing an API with Supertest, Testing Errors, with a Fresh Start for Every Test.

Updated: November 19, 2026

1. [Testing an API with Supertest](https://www.ask-codey.com/lessons/node-testing-supertest) (Journeyman): Supertest hands a request straight to an Express app, with no server running and no port, so a test can check the status code, the headers and the JSON body that come back, for a GET and for a POST with a body.
2. [Testing Errors, with a Fresh Start for Every Test](https://www.ask-codey.com/lessons/node-testing-errors-and-fresh-state) (Journeyman): An API's error answers, such as 400, 404 and 409 with their JSON bodies, are part of what it promises, so they get tests too, and beforeEach puts the in-memory data back before every test, so each one starts from the same seats.

Source: https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-testing-apis
