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.
Finish up on test error handling
From the course: Learning End-to-End Testing with Jest
Finish up on test error handling
- [Instructor] Tests description for the endpoint that retrieves a specified record from the database is, "It should not retrieve any recipe from database, "internal server error" 'Spy On' the Recipe Service and 'fetch By Id' function. Mock the next con to feel with a method "Mock Rejected Value Once". Con the endpoints with the recipe ID of the recipe you want to retrieve from the database expect (res. Status Code) to be 500 and (res. Body), to be an object Containing success: false and message : 'Some error occurred while retrieving recipe details' Server run tests. Good. 25 tests passed, coverage, 98.55% from the test coverage table line 93 of the recipe controller fell is now covered. The tests description for the audits end point is it should not update recipe in database, 'internal server error' Define your input name, chicken nuggets, "Spy On" the recipe, service and fetch by…