jasmine2.0

how to test and resolve Controller data (.then function()) promise and get orginal Data in Jasmine2

大城市里の小女人 提交于 2019-11-27 04:54:22
问题 I am testing a controller that uses a service that returns a promise. I need to resolve promise. I am using Jasmine 2. Here is Spec code beforeEach(inject(function ($controller, $rootScope, _myService_, _$q_, _$rootScope_, _$httpBackend_, $http) { scope = $rootScope.$new(); $q = _$q_; $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; myService = _myService_; $http = $http; ctrl = $controller('Ctrl', { '$scope': scope, 'myService': myService }); spyOn(myService, "getDateRangeData").and