Mock the HTTP client or spin up a fake server

Back to list2024-02-07
You

Mock the HTTP client or spin up a fake server?

ChatGPT

A fake server, when the protocol matters. Mocks encode your belief about the API, so they keep passing after the real one changes. A local server exercises serialisation, headers and timeouts, which is where the bugs actually live.

You
sourdough-crumb.png
You

Which edge cases deserve a test in a small project?

ChatGPT

The ones that already bit you, and the boundaries: empty, one, many, malformed, and the largest input you claim to support. That list catches most regressions without turning the suite into a second implementation.