Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$browser.$$checkUrlChange is undefined in a 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 on line 12502 of angular.js is indeed undefined.

As a temporary solution, I changed the invocation on line 1250 to $browser.$$checkUrlChange && $browser.$$checkUrlChange()

But I cannot help to wonder whether this monkey-patch can hurt me in some other way.

Any clue on how to solve this properly is much appreciated.

In case I do not get my answers I might consider opening a bug at the Angular repo on GitHub.

like image 346
Oleg Belousov Avatar asked Sep 18 '14 15:09

Oleg Belousov


1 Answers

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

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

like image 115
user1831230 Avatar answered Oct 14 '22 00:10

user1831230