6

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.

Oleg Belousov
  • 9,981
  • 14
  • 72
  • 127
  • 1
    possible duplicate of [jasmine test fails with undefined is not a function(evaluating $browser.$$checkUrlChange())](http://stackoverflow.com/questions/25785149/jasmine-test-fails-with-undefined-is-not-a-functionevaluating-browser-checku) – Michael Benford Sep 18 '14 at 17:31
  • You should post your answer, sir :) – Oleg Belousov Sep 28 '14 at 07:55

1 Answers1

6

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())

Community
  • 1
  • 1
user1831230
  • 136
  • 3