Unit Tests for Product Routes Part 2
Learn how to test the endpoints for updating an existing and a non-existent product.
We'll cover the following...
We'll cover the following...
Updating with garbage values
Here, we are testing our update product functionality with garbage JSON values. This test should return 400 Bad Request. However, if we run our test, we get an exception instead:
So let’s take a deep breath and look at our code:
As we can see, we have done no error handling at all. So maybe we should rewrite this a ...