Skip to content Skip to sidebar Skip to footer

Testing If Js Method Throws Rangeerror With Qunit

I made some Javascript unit tests with QUnit library, then I want to test if method throws RangeError. It has be done in this way: QUnit.test('Resolve slide animation from left', f

Solution 1:

I found an answer on my own. Instead calling function:

assert.throws(myOwnCreator.resolveAnimationType("slideSide", "hide"), 
  newRangeError()....

I should pass to assert.throws() function which call my function, like this:

assert.throws(function(){
    myOwnCreator.resolveAnimationType("slideSide", "hide");
  }, 
  newRangeError(--message which function should throwin error--)...

Post a Comment for "Testing If Js Method Throws Rangeerror With Qunit"