Writing good unit tests is made much easier by **dependency injection**. This
lets you separate your code's behavior from that of your dependencies.
Many people use **mocks** to add dependencies to unit tests. I think this is
usually a mistake.
But on unit test, you’re testing that specific function. How the other function works, should not be our concerns, just handle the mock based on contract or expected output
For testing the whole flow, should use other tests like Integration tests
But on unit test, you’re testing that specific function. How the other function works, should not be our concerns, just handle the mock based on contract or expected output
For testing the whole flow, should use other tests like Integration tests