DELETE
The deletePerson function is really similar to the getPerson function and so is its test. The only difference between the two is that on a success you return a status, and you will need to stub a deleteFromDb function. Try and write the test on your own without just copying from the tutorial. The full test is written down below. See how close you can get! No peeking! You can do it!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Here it is:
Once your test is all fixed up, you are ready to write your deleteFromDb function and the deletePerson function. It is almost exactly the same as the getPerson function, because you will have to see if it is there before you delete it. Instead of returning a person, you delete the person and return a 204 HTTP status. Try it out on your own!
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Test it before you check down below to see if it is right.
.
.
.
.
.
.
.
.
.
.
.
Here it is done:
And here is the deleteFromDb:
Nice Job!!
Only one more method to go!