title: How to test window.location.href using jasmine
body: <p>This is my controller code</p>
  
  <pre><code>$scope.loadApplications = function () {
        var cacheKey = { key: cacheKeys.appList() };
        dataFactory.get("/Application/All", { cache: cacheKey })
               .then(function (result) {
                   $scope.count++;                     
                   $scope.applications = result.data.data;
                   $scope.filteredApplicationsList = $scope.applications;
                    if ($scope.applications.length===0){
                       $window.location.href = '/Account/WelCome'
                   }
                   else {
                       $scope.isLoad = true;
                    }
  
               });
    };
  </code></pre>
  
  <p>and this is my jasmine test cases for above function</p>
  
  <pre><code>  it('should redirect to welcome page', function () {
          scope.applications = {};
          scope.loadApplications();
          expect(window.location.href).toContain('/Account/WelCome');
      });
  </code></pre>
  
  <p>but it is taking the current url of browser and it is raising an error as</p>
  
  <pre><code>Expected 'http://localhost:49363/Scripts/app/test/SpecRunner.html' to contain '/Account/WelCome'.
  </code></pre>
  
  <p>can anybody please tell me how to test the url?</p>