News for hackers. Stuff that matters.
Re:Database mocks are just not worth it by jokesterfr on Monday December 30, 2024 @06:58PM (#42554964)
We do both at work (~300k sloc, >70% unit test coverage).

There are unit tests with mocks on repository calls, and integration testing with a fresh pg database bootstraped with docker and .sql seeds.

One is fast to code, one gives more realistic feedbacks on real life execution. Both solve issues.

This is not the end of the game tho, as performance and back pressure issues arises whith a successful project... Testing is a long and interesting process.

Re:Database mocks are just not worth it by nerdponx on Monday December 30, 2024 @08:54PM (#42555603)
Mocking out a repository is IMO a lot less bad than mocking out an actual database connection. That's probably one of the biggest arguments in favor of the repository pattern: the ability to replace the repository with a test double of some kind.