[Solved] Testing javascipt using jasmine


Hope your questions is not about any problem, Here i’m attaching basic things for you to understand jasmine . I guess you have already did the setup of jasmine to start writing test cases. Here is a sample example.

function helloWorld() {
 return 'Hello world!';
}

describe('Hello world', function () {
 it('says hello', function () {
   expect(helloWorld()).toEqual('Hello world!');
 });

 it('Is defined', function () {
   var name = "Alex";
   expect(name).toBeDefined(); // Return true as name is defined. 
 });
});

Here is the Reference to understand the basics. Happy coding.

5

solved Testing javascipt using jasmine