Jasmine Setup

The first time using Jasmine. This is step by step example:

function helloWorld() {
    return "Hello World!";
}
  • Add test files to /spec: HelloWorldSpec.js
describe("Hello world", function() {
    it("says hello", function() {
        expect(helloWorld()).toEqual("Hello world!");
    });
});
  • Edit file SpecRunner.html: include source and spec files in include source files here and include spec files here
  • Run the SpecRunner.html

Visit Jasmine home for more assert statements.

References:

Posted in  testing       testing   jasmine   frontend