Basic Jasmine Runscript

describe(‘Test Jasmine Functionality…’, function () {
var jasmineUnitTest = ”;
// where you can do setup for test.
beforeEach(function () { jasminUnitTest = “hello” });
// where you can do cleanup for test
afterEach(function () { jasmineUnitTest = “”; });
it(‘Testing true..’, function () {
expect(true).toBeTruthy();
});
it(‘Testing proper addition..’, function () {
expect(1 + 1).toBe(2);
});
it(‘Testing not proper addition..’, function () {
expect(1 + 2).not.toBe(2);
});
it(‘Testing beforeEach set jasminUnitTest = hello’, function () {
expect(jasmineUnitTest).toBe(“hello”);
});
})

//Matchers
// use .not. for reverse
//toMatch(regex)

//toEqual = C# ==
//toBe = C# ===

//toBeLessThan = < //toBeGreaterThan = >

//toBeDefined()
//toBeUndefined()

//toBeNull()
//toBeTruthy() -> checks for true
//toBeFalsy() -> checks for false

//toContain() => contained within an array
//expect(funtion(){somemethod();}).toThrow(ex) uses callback to throw expection.

Share on Facebook

Leave a Reply

Your email address will not be published. Required fields are marked *