Unit vs Integration testing :) It is important to spin up angular and test the functionality as a…
Tomas Trajan
1

We both agree that non-Angular code should be tested outside of an Angular container. I think the difference between the two kinds of tests is known as “in-container” vs “mock object” testing.

Separating code that is tightly-coupled or dependent on Angular services into another file hurts the reusability of that code immensely (in the ways I described). Many organisations that I’ve worked with cannot reuse their own components across their own teams because it’s so hard to identify all the implicit dependencies of a single component when it’s written this way. So they end up spending extra $$$ and time re-writing the same components.

If they had favoured a modular-design from the start, that would have allowed them to write good, fast unit tests (both in-container and mock-object ones) AND the components would be much-more easy to reuse by their peers.