jeudi 19 novembre 2015

Simple JSMockito Example

I'm new to JSMockito but can't really seem to find a step-by-step guide as to how I should go about using it to test some of my JavaScript methods/objects. I've already looked at the official website for JSMockito but I'm having trouble following/understanding what steps should be taken.

Say for example, I had this method which just takes two integers and divides one by the other:

function myDivision(a,b) {
    return a / b;
}

How would I go about testing it with JSMockito? i.e. do I need to import anything, how do I initialise a mock, assert a test etc?

Likewise, how would I go about testing an object too?

Many thanks in advance!

Aucun commentaire:

Enregistrer un commentaire