Hi I am requesting a JSON file from an external URL https://...json.
When running my tests it causes an unexpected error even though I did not write any tests on my functions yet. Only the tests for my controller fail (at the $scope.$digest()).
My code looks as follows
Service:
angular.module('myApp').service('dealService',['$http','$location',function($http,$location){
this.deals = function () {
return $http({
method: 'GET',
url: 'https://myurl.com/deals.json'
}).then(function (response) {
return response.data;
});
};
}]);
This returns an array which I then take as promise such as Controller:
$scope.dealsLanding = [];
dealService.deals().then(function (deals) {
$scope.dealsLanding = deals;
});
This however seems to cause my tests to fail. Error: Unexpected request: GET https://myurl.com/deals.json No more request expected.
What can I do about it?