Sad path tests
In the tests we've written so far, we've only tested what's known as the "happy path", in other words we've been writing tests based on everything going right.
But what happens if we supply eronous data? It's important that we know our error handling is working.
Let's start by adding two more test cases to our GET /items/:id suite.
Since these are fairly simple to create, I'll show you the finished code and go through the explanation.
Click to load comments...