From the course: Learning End-to-End Testing with Jest

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Test the Read endpoint

Test the Read endpoint

- Let's start with reading all the recipes saved to the Database. The describe method has a description of get forward slash recipes. And the tests description is: it should retrieve all the recipes in the database. Call the get all endpoints. We expect the status code to be 200 and the restaurant's body to be an object containing success, true and data, any array. Server run test. Good, 11 tests pass. Our coverage is now 72.46%. Lets test the end point that retrieves a specified recipe. The describe method has a description of get forward slash recipes forward slash ID. And the positive test will have a description of: retrieve a specified recipe in the database. Call the endpoint with the ID of the recipe you want to retrieve. We expect the status code to be 200 and the response body to be an object containing success, true and data of any objects. Server run test. Great, 12 tests passed…

Contents