This week I worked on another API thoroughly testing it with Jest and supertest. I found jest easy to use and I think I'll use it from now on.
I had started this project over the weekend so I had got a little bit of it done already. On Monday I connected the project to the database and started debugging using a VScode extension "Jest Runner" I was able to use the breakpoints to view the code at certain stages of the test which made debugging a lot easier.
On Tuesday I started with a test for error handling using a try/catch block as well as adding a middleware for the error message. I also added the getAllTodos function for the todos, I had already done the post function over the weekend.
I decided to update some of my readmes and my projects guide repo on Wednesday to show off some of the other projects I've been doing. Next week I'm gonna be doing job applications so it's best to be prepared.
I then handle the getTodoById function adding in the error handling for if you try to get a todo with an invalid ID. I was quite familiar with Jest at this point as some of the tests were quite similar.
On Friday I continued working on my todo API adding the update function for while making sure it was returning soon and errors were being caught and displayed.
Overall I was happy with this week I'm significantly more comfortable using jest and I'm confident to start building a full-stack project using an API. Next week I plan to do a lot of cover letters and job applications.