Jasmine Test Basis Example

Sample Jasmine Test

Below is very basic an example of a Karma test:

describe('when I am testing', function (){
it('should display that the test is successful', function (){
    expect(true).toBeTruthy();
  });
});

Basic Jasmine Syntax

describe('',function(){
	beforeEach(function(){
	});
	
    it('',function(){
	});
});

This is what it all means:

  • describe: Short description of the test
  • it: specific assertion (in a string)
  • expect: assertion against the values
  • toBeTruthy: Sample property on an expectation that is used to make the assertion

Jasmine Assertions