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 Update endpoint
From the course: Learning End-to-End Testing with Jest
Test the Update endpoint
- [Instructor] Now is the time to test the update endpoint. I will group tests for the update endpoint in a describe method and give it a description of 'PATCH/recipes/:id'. For the positive test, the description is 'update the recipe record in the db'. Define the input which is the update you want to make. So name is 'chicken nuggets'. Call the update endpoint with the ID of the recipe you want to update. Send the input and set the authorization. We expect a response with statusCode of 200 and response body of an object containing success : true and data of any object. Save and run tests. 14 tests passed. Our coverage is 88.41% The updates will have a good number of negative tests, just like the create endpoint. The first is to test for a user who wants to update a recipe with an invalid difficulty value. The test description is 'it should not update recipe in the db, invalid difficulty value'.…
Contents
-
-
-
-
-
(Locked)
Test the Login endpoint6m 50s
-
(Locked)
Finish up on Login endpoint test7m 1s
-
(Locked)
Test the Create endpoint5m 16s
-
(Locked)
Finish up on Create endpoint test6m 27s
-
(Locked)
Test the Read endpoint5m 21s
-
(Locked)
Test the Update endpoint6m 44s
-
(Locked)
Finish up on Update endpoint test6m 1s
-
(Locked)
Test the Delete endpoint3m 55s
-
(Locked)
-
-