I am encountering an issue with a file named run.js
. The content of the file is as follows:
window.map.run([
'$rootScope', '$location', 'cache', 'userCache',
function($rootScope, $location, cache, userCache) {
userCache.checkSession().then(function(result) {
if(result.userId) {
cache.set('login', 'successfulLogin', true);
if($location.path() !== '/patients') {
$location.path('/patients');
}
}
});
}
]);
This code runs when the application loads, which is typically desirable behavior. However, I encounter challenges when unit testing controllers. I am struggling to understand how to use spy
or mock
to ensure that this functionality does not execute. Any suggestions on how to approach this?
Thank you!