Testing is essential for long term maintainability. We’re not perfect testers at Versett, but we believe that if we write modular chunks of testable code, it will age more gracefully than if we didn’t. In our initial Angular projects we made the mistake of not testing, which led to regressions making their way into production on more than one occasion. We now ensure all our code is thoroughly tested and you can find .spec.ts files throughout our codebase.
Angular was built to be tested. It includes a large suite of testing tools and has dependency injection baked into the core of the framework. Dependency injection makes mocking out services, pipes, directives, and components incredibly easy. Keeping your components tiny, dependency injection, and mocking helps to ensure that we precisely test small chunks of code for more useful test cases. The
... read the whole story at medium.com.