Say hello to Jasmine test suite

As long as we have to use a testing framework to build a test suite, there are some basic and common assertions on all frameworks. It's important to understand those assertions and spies and when to use them.

In this section we will explain the assertions and spies from Jasmine, as Jasmine will be our testing framework throughout the book.


Any test suite begins with a global Jasmine describe function, which receives two parameters. The first one is a string and the second one is a function. The string is the suite name/title, and the function is for the code block that will be implemented in the suite.

Consider the following example:

describe("A sample test suite to test jasmine assertion", function() { // .. ...

Get Angular Test-Driven Development - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.