The unique thing about components with respect to services and pipes is that the components interact with the user interface. Components have a template that can alter the state of the component and its properties, and in the similar fashion, components may alter the content of the user interface.
So, to test components, we can employ two different strategies:
- Test components in isolation, which means we test components in a similar fashion as the services and pipes. We do not consider the template part of the component and neither test those. This approach is useful if we just want to test the logic that resides in the component. But this way, we may not get the comprehensive test cases for our components.
- Test components end-to-end. In this case, we test components in conjunction with their template. This way, we can test the impact...