Tesla Bypass
Yesterday I started the Elixir challenges of my bootcamp. I learned how to use Tesla to handle API requests, and how to test them with Bypass.
I really liked Bypass because it creates
a local server that handles http request during testing.
It’s very easy to use:
you just declare it in your tests
and define the response of an arbitrary endpoint.
This is way better than mocking or VCRing an API for tests
since it actually makes the request and it’s not an ad-hoc solution.
However, If I had to choose I’d always pick mocks over VCRs. I’ve had terrible experiences with VCRs and I’ve never enjoyed using them. It’s a quick testing solution that quickly becomes unmaintainable.
Today I’ll try to finish all the challenges.