$ browser. $$ checkUrlChange在茉莉花测试中未定义

时间:2014-09-18 15:45:20

标签: javascript angularjs unit-testing jasmine karma-runner

我有以下测试:

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

我收到以下错误:

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)

调试时,我发现$browser.$$checkUrlChange的{​​{1}}行12502确实未定义。

作为临时解决方案,我将第angular.js行的调用更改为1250

但我不禁想知道这个猴子补丁是否会以其他方式伤害我。

非常感谢任何关于如何正确解决这个问题的线索。

如果我没有得到我的答案,我可以考虑在GitHub上的Angular回购中打开一个错误。

1 个答案:

答案 0 :(得分:6)

您在angular和angular-mock的版本中不匹配。 见这里:

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

相关问题