we often run 2 layers of tests , one for testing business logic only (quick set, if you will) and another for testing everything including throwaway db instance that we temporarily run in docker. mocking db level behavior in your tests is very error prone due to assumptions about it's behavior. i would advise you don't try mocking that, use the actual test db instance instead. it's a place where docker naturally fits very well.
yeah I am doing integration tests (with clj-test-containers
), but here this piece of code is not separating logic and persistence
and I realized this right after the convo with Sean ... 😄 Not going to mock any db behavior 😉
a good talk on the topic - https://www.youtube.com/watch?v=WtdegIqQbrg
at about 14:45 into the part he gets to a similar point , but its worth watching the whole thing