Before writing our first Jasmine test, we need to understand the difference between a suite and a spec (test specification) in Jasmine. Jasmine suite is a group of test cases that can be used to test a specific behavior of the JavaScript code. In Jasmine, the test suite begins with a call to the describe
Jasmine global function that has two parameters. The first parameter represents the title of the test suite, while the second parameter represents a function that implements the test suite.
A Jasmine spec represents a test case inside the test suite. In Jasmine, the test case begins with a call to the Jasmine global function it
that has two parameters. The first parameter represents the title of the spec and the second parameter represents a function that implements the test case.
A Jasmine spec contains one or more expectations. Every expectation represents an assertion that can be either true
or false
. In order to pass the specs, all of the expectations inside...