Hacker News new | past | comments | ask | show | jobs | submit login

The benefit is doing integration tests, testing the glue between your components. By mocking down to the HTTP level you can be sure that the code will work end to end, which is inside your whole codebase.

Imagine that fetch suddenly has a bug (extreme example but it could be another open-source library). Your tests above wouldn't catch it.

I always strive to do at least a few integration tests like these and not stand purely on individual unit tests.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: