Refactor 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 so as to make it easy to test. For example, consider refactoring your component code into services and focusing on service tests.