1. I spent about 5 hours working on this assignment.
2. Most of the time I spent was trying to get the test library to work. I tried fixing jest, but was unable to. I tried vitest, but the tests would randomly fail and then work. I ended up using the native node test runner. The downside is it requires Node 20 to work. Trying to get the tests to run took about 4 hours and the code/tests took about 1 hour
3. The actual code part wasn't too bad, but I struggled with trying to get the tests to run like I mentioned previously. I think starting off a with a test runner library that has good compatibility with Windows would've saved a lot of time and improved my experience
1. It wasn't a bug per say, but when I was adding a response type to the responses, it helped me realize that there were inconsistentcies with some of the json I was returning. For example, some error responses were {error: msg} and others were {errors: msg}. The type system is really helpful, but it isn't ideal in situations where there can be a lot of types. For the responses, there were so many types that a Response could be that I don't know how useful it would be to help catch a bug.
2. I struggled with json types. I kept thinking I can do {type: type}, but it seems like with jsons, you can only do {key: type}. However, I think I am starting to get better at Typescript and I don't think there are any topics that are confusing me.
1. Writing tests were a little boring, but definitely useful. They changed how I would normally debug and test. I didn't test all the routes manually since I figured they would be tested via the unit/integration tests anyways.
2. My tests did help find bugs. The tests helped me find a bug where I was determining whether an author id existed or not incorrectly in the post route for books.
3. I think I would write the tests beforehand as a way to guide my code and so I can get instant feedback whether the code was working or not as I wrote it (kind of like how we did it in SE181.) I don't think I really learned anything while testing other than finding bugs and learning more about the testing libraries themselves.