I have a function that when doesn't find anything stored in the cookie,redirects to some page specified as:
showEnrollRoute: function(){
var username = Application.utils.getCookie("username");
if(username != null || username != undefined){
Application.vent.trigger("refresh:header");
var channel = module.getChannel("counties");
channel.then(function(channel){
channel.request("fetQuestions");
});
} else {
console.log("Start");
window.location.href= Application.getConfig("logoutSuccess");//error point
console.log("End");
}
}
The window.location.href is causing the unit-tests to fail.
Some of your tests did a full page reload.
I did some research and found out that I've to mock $window object in unit test to prevent reloading the page when running tests?
Can anyone please suggest a way to go about it? Thanks in advance!
EDIT: This problem is same but the question is different now. I have found out that the mocking the $window object inside test-case would stop the the error from happening. Can anyone please suggest a way to go about it?
Aucun commentaire:
Enregistrer un commentaire