Hacker News new | ask | show | jobs
by Mavvie 844 days ago
Can you (or someone else) explain what the alternatives are? How can I write unit tests without mocks or fakes?
1 comments

They might mean that rather than using a mock, use a real typed object/instance of a real thing and inject it into the unit that you’re testing. Admittedly, that might meet the definition of a fake/mock once you get down to the level of testing something that needs db access. Another way of interpreting that is that you can use in memory versions of your deps to mirror the interface of your dependency without needing to repeatedly, and possibly haphazardly mock certain functions of your dependency.