Setting up the unit testing environment
The app scaffolded by Ionic CLI does not include any test setup as of the day of writing this chapter. So, we need to add the required testing setup ourselves.
Setting up the project
To start with, we will create a new folder named chapter9
and copy the todoapp_v2
from chapter8
folder to the chapter9
folder.
Install the dependencies if they are missing by running npm install
from the root of the chapter9/todoapp_v2
folder.
Run ionic serve
and see if the app is working as expected. When you create, update, and delete a todo
, you may see a warning in the console mentioning that the Cordova environment is not present. This is because we are using the local notification plugin inside the browser.
The environment setup we are going to do for unit testing our Todo app is going to be based on the article: Ionic 2 Unit Testing Setup: The Best Way (http://www.roblouie.com/article/376/ionic-2-set-up-unit-testing-the-best-way/).
To get started we are going to install...