mercredi 18 novembre 2015

Js test function that does not return anything

I am using mocha and sinon. i have for example this function:

function doSomething(param) {

   if(param === 'something') { // do something }

}

How i can create test that check if the condition not true then the function does not do anything?

it('should do something if param equal something', function() {
   // this part i know
});

it('should not do anything if param not equal something', function() {
   // how to test this part?
});

Aucun commentaire:

Enregistrer un commentaire