10 ms·
> If function A calls function B, you've got to mock function B out. If you refactor function B, you better update the mock as well This is why isolation and e
by berkes 5y ago
> If function A calls function B, you've got to mock function B out. If you refactor function B, you better update the mock as well
This is why isolation and encapsulation are important.
Your tests were telling you that A has intricate dependencies on B. If the tests for A start failing when you refactor B, they were (too) tightly coupled. The tests are telling you this (whether or not you act on this is another discussion).
And when the tests for A keep passing even when you broke B -false positives- you should see at least one integration (or even e2e) test failing. If not, the tests are showing a hole in the coverage.