Hacker News new | ask | show | jobs
by sfn42 167 days ago
I use test containers and similar methods to test against a "real" db, but I also use mocks. For example to mock the response of a third party api, can't very well spin that up in a test container. Nother example is simply time stamps. Can't really test time related stuff without mocking a timestamp provider.

It is a hassle a lot of the time, but I see it as a necessary evil.

1 comments

You can use a library like [1] to mock out a real HTTP server with responses.

[1] https://www.mock-server.com/