Supertest
How to Test Your Express API with SuperTest
Express is the most popular Node.js framework for building web applications, especially REST APIs. And in this article, I’m going to show you how you can test your API endpoints with a cool library called SuperTest.
SuperTest is an HTTP assertions library that allows you to test your Node.js HTTP servers. It is built on top of SuperAgent library, wich is an HTTP client for Node.js.
Getting Started
The best way to learn how to write tests is by testing an existing app. So, in this tutorial we’re going to use the blog REST API I built using Express and Mongoose which you can read more in this article. You can clone the repo onto your computer using the command below.