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

Table of Contents (17 chapters)
AngularJS Web Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
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.