3 ms·
I prefer to mock everything, with one exception: Refactoring old code that wasn't built with unit testing in mind. For this, I'll go with the "social" unit tes
by aussieguy1234 5y ago
I prefer to mock everything, with one exception: Refactoring old code that wasn't built with unit testing in mind.
For this, I'll go with the "social" unit tests up to the point where the code calls an external service or crosses a network boundary. I'll always mock these things because they slow down your tests massively. A 500ms external service or db call might not sound like much but multiply that over 5000 tests.... I'll still try to mock whatever I can that can be mocked with minimal effort.