I am getting below error(which is OK!) when called tohaveBeenCalledWith
:
spy showError to have been called with [ '33' ] but actual calls were [ Function, 403 ]
Is there any way I can test Function that the function called with?
Assuming that the argument Function is testFun, How can I test if $window.location.href hascorrect value applied
function testFun(errorStatus) {
switch (errorStatus) {
case 401:
$window.location.href = url1;
break;
case 403:
$window.location.href = url2;
break;
default:
console.log('Something went wrong');
}
}
Yes. You can do that using
jasmine.any
Quoting the documentation example:
Hope that helps!