### -------------------------------------Unit Test Instruction-----------------------------------

#### Create Unit Test

- Create a folder under any folder, name: kbtest
- Create one or more regular js file to store your unit test
- Create one function for every unit test, that function will be called during test

#### Add reference in your JS file

- Create a file in your folder, name: ref.txt
- Insert one reference url one line in the file
- The reference js will be added when running the test

#### Use of requireJs

- You should place your unit test as functions inside the second argument of Require or Define function. Exmaple:

                      require(["util"], function(u) { function YourUnitTest(){expect(a).to.be(b);}   function SecondUnitTest(){expect(a).to.be(c);} });

#### Assertation syntax

It uses the expect.js assertation, see: https://github.com/Automattic/expect.js

Example:

- expect(window.r).to.be(undefined);
- expect({ a: 'b' }).to.eql({ a: 'b' })
- expect(5).to.be.a('number');
- expect([]).to.be.an('array');
- expect(window).not.to.be.an(Image);

#### kMock syntax

Example:mock new Object

- var helper={}
- KMock(helper).callFake("test",function(){return 1})
- expect(helper.test()).to.eql(1);

Example:mock exist Object

- var helper=new Helper()
- KMock(helper).callFake("getname",function(){return "name"})
- expect(helper.getname()).to.eql("name");

Example:flush mock

- var helper={getname:function(){return "helperName"}}
- KMock(helper).callFake("getname",function(){return "name"})
- expect(helper.getname()).to.eql("name");
- KMock(helper).flush()
- expect(helper.getname()).to.eql("helperName");