Refactoring Hard-to-Test Code
As you start writing unit tests, you may find that a lot of your code is hard to test. The best strategy is often to refactor your code to make it easy to test. For example, consider refactoring your component code into services and focusing on service tests or vice versa.