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

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Test the Create endpoint

Test the Create endpoint

- Let's get straight into writing tests for the create endpoint. All group tests for this endpoint in the described method with description, post forward slash recipes (computer keyboard keys clacking) First thing is to write the positive test. (computer keyboard keys clacking) The description is, it should save new recipe to database. (keyboard keys clacking) The input should be (computer keyboard keys clacking) name: "chicken nuggets" difficulty: two vegetarian true (computer keyboard keys clacking) Call to create end points, Sending the inputs and set the authorization bearer with the access token, returned from testing the login endpoint (computer keyboard keys clacking) Expected status code is 201 Response body is (keyboard clacking) an object containing success, True and data of any object. (keyboard keys clacking) Now that we have a recipe saved to the test database, let's assign its…

Contents