6
使用Jasmine进行角单元测试:如何删除或修改spyOn
AngularJS v1.2.26 茉莉花v2.2.0 如何更改或删除a的行为spyOn?当我尝试覆盖它时,出现以下错误:Error: getUpdate has already been spied upon var data1 = 'foo'; var data2 = 'bar'; describe("a spec with a spy", function(){ beforeEach(module('app')); var $q; beforeEach(inject(function(_updateService_, _$q_){ updateService = _updateService_; //spy the results of the getUpdate() $q = _$q_; var deferred = $q.defer(); deferred.resolve( data1 ); spyOn(updateService, 'getUpdate').and.returnValue(deferred.promise); …