Book Image

Mastering AngularJS for .NET Developers

By : Mohammad Wadood Majid, Golrokh Mirzaei
Book Image

Mastering AngularJS for .NET Developers

By: Mohammad Wadood Majid, Golrokh Mirzaei

Overview of this book

<p>AngularJS is an open source framework that utilizes the Model-View-Controller architecture for client-side application development. AngularJS is referred to as the Angular framework.</p> <p>With this book, you will soon be able to build client-side data driven applications. The introduction section covers the essentials of AngularJS, covering the core concepts of AngularJS to ensure a smooth transition to the more advanced topics discussed later on.</p> <p>This book covers the development of client-side applications with AngularJS using code examples before moving on to explore how to build the ASP.NET Web API and its features using Visual Studio .NET.</p>
Table of Contents (15 chapters)
Mastering AngularJS for .NET Developers
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Unit testing using Jasmine


Jasmine is an open source framework, which is the most popular choice for unit testing of AngularJS applications. Jasmine is a framework for JavaScript test driven development. Jasmine provides functions and assertions to structure the test. Jasmine can be executed on any JavaScript-enabled framework, as it does not require any integrated development environment (IDE).

The Jasmine framework is informal to read. Let's assume that we have a helloWorld() function for which we want to write a test using Jasmine. The following is the unit test code:

describe('Hello world', function() {

  it('says hello', function() {

    expect(helloWorld()).toEqual("Hello world!");

  });

});

In the preceding code the describe() function is known as a suite of tests and the it() function is an individual test specification used with the JavaScript function to figure out what the helloWorld() function will do. As you can see in the preceding example, if helloWorld() is not equal to...