

If you are curious about all the endpoints available, or about the application architecture, go to the routing file of the application here.Īssuming you have cloned and set up the application on your machine, all endpoints are already present. Note: The focus of this tutorial is testing with Jest, not developing a space API repository, so there are no steps for that.

Start the application (API server): npm startĪfter running these commands, we can start writing tests. Set it up with this command to install the application dependencies: npm install The API for this tutorial has already been developed. I have chosen an API based on space travel, so gear up prospective space explorer! For this tutorial, we will use a simple API that will give us responses we can use to write our tests. This is what we will write tests against. To start writing our cool Jest tests, we first need to have our API running. To access the entire project, clone the repository by running this command: git clone -single-branch -branch base-project This tutorial will take you through the process of writing Jest tests for a dummy space API project. Our tutorials are platform-agnostic, but use CircleCI as an example. Basic understanding of APIs and unit testing.Postman or any other HTTP client to test the API.To complete this tutorial, you will need:
Negative api testing postman how to#
In this tutorial, we will go through how to use Jest to test nested API responses and hopefully have fun in the process. While Jest is most often used for simple API testing scenarios and assertions, it can also be used for testing complex data structures.

Jest is great for validation because it comes bundled with tools that make writing tests more manageable. Jest is a JavaScript-based testing framework that lets you test both front-end and back-end applications.
