Book Image

AngularJS Web Application Development Blueprints

By : Vinci J Rufus
Book Image

AngularJS Web Application Development Blueprints

By: Vinci J Rufus

Overview of this book

If you are a web application developer interested in using AngularJS for a real-life project, then this book is for you. As a prerequisite, knowledge of JavaScript and HTML is expected, and a working knowledge of AngularJS is preferred.
Table of Contents (12 chapters)
11
Index

Unit testing our application


The angular-seed project comes with Unit testing baked in. In the terminal window, run the following command:

npm test 

This will run the default tests and show the output in the terminal window. We will notice that the tests fail. The reason being our tests are looking for the myCtrl1 or myCtrl2 function within our controller, but it isn't there.

Let's open up our test/unit/controllersSpec.js file and remove those default tests. Save the file and immediately you will notice that our tests pass.

Let's write our Unit test to test the web services we wrote.