|
|
|
|
|
by adamkl
2344 days ago
|
|
Yes! Yes! Yes! I've been preaching this approach ever since watching Gary Bernhardt's talk on "Boundaries" [1]. Splitting conditional logic from dependencies makes code so much easier to test. If you can do that, there's no need to mock anything. You can just pass simple data objects into your conditional logic for testing, and use a handful of integration tests to validate the end-to-end flow. [1] https://www.destroyallsoftware.com/talks/boundaries |
|
With the exception of callbacks (and async solves that for single-issue scenarios), arguments don't need to be mocked. They're just arguments.