January 2016
Intermediate to advanced
278 pages
4h 53m
English
To write tests, you should create two things: test suites and specs. A spec (short for specification) is a piece of functionality that you are testing from your code; for example, if your code is calculating tax of 5% for $100.00, you would expect it to be $5. A test suite is a set of expectations that are grouped under a topic. In the preceding example, the test suite can be "Invoice totals calculation".
To start working with Jasmine, you should install it from npm, as follows:
$ npm install --save-dev jasmine
Then, you can start writing your tests. With Jasmine, you have two functions: describe() to create test suites and it() to make specs:
// specs/mathSpec.js describe('Basic mathematicfunctions', () => { it('should ...Read now
Unlock full access