$ browser. $$ checkUrlChange - undefined in jasmine test

I have the following test:

it('should maintain a bind between the data at the $scope to the data at the ingredientsService', function(){ $scope.addFilters('val1', $scope.customFiltersData, 'filter1'); $scope.$digest(); expect($scope.customFiltersData).toEqual(ingredientsService.filters()); }); 

I get the following error:

 TypeError: undefined is not a function at Scope.$digest (/home/oleg/dev/vita-webapp-new/bower_components/angular/angular.js:12502:17) at null.<anonymous> (/home/oleg/dev/vita-webapp-new/test/spec/controllers/customfilters.js:92:20) 

When debugging, I saw that $browser.$$checkUrlChange in line angular.js really undefined.

As a workaround, I changed the call on line 1250 to $browser.$$checkUrlChange && $browser.$$checkUrlChange()

But I can't help but wonder if this monkey patch could hurt me in any other way.

Any clue on how to properly solve this problem is greatly appreciated.

In case I don't get my answers, I might consider opening an error in the Angular repository on GitHub.

+6
javascript angularjs unit-testing karma-runner jasmine
source share
1 answer

You have a mismatch in the version of angular and angular -mock. See here:

jasmine crashing with undefined is not a function (evaluating $ browser. $$ checkUrlChange ())

+6
source share

All Articles