Unit testing
Unit tests are used to test small pieces of application code functionality for correctness. This also allows us to verify that the functionality continues to work as expected, when you refactor code and/or add new features. Both NativeScript and Angular offer unit testing frameworks. We will explore both types of unit testing, as they both have pros and cons.
Developing tests at any time is good. However, it is preferable to develop them alongside your development of the project's code. Your mind will be fresh on the new features, modifications, and all the new code you just added. In our case, because we are presenting lots of new concepts throughout this book, we haven't followed the best practice since it would have complicated the book even more. So, although adding tests later is good, adding them before or while adding your new code is considered the best practice.
Angular testing
The first type of unit testing we will cover is Angular unit testing. It is based around Karma...