를 플러시 보류중인 요청을 포기하지,하지만 카르마 나에게이 오류 제공 : Error: No pending request to flush ! at Function.$httpBackend.flush
테스트
'use strict';
describe('profileCtrl', function() {
var scope, $httpBackend;
beforeEach(angular.mock.module('maap'));
beforeEach(angular.mock.inject(function($rootScope, $controller, _$httpBackend_){
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', 'profile').respond([{id: 1, name: 'Bob'}]);
scope = $rootScope.$new();
$controller('profileCtrl', {$scope: scope});
}))
it('should fetch list of users', function(){
$httpBackend.flush();
expectGET(scope.current_user.length).toBe(1);
expect(scope.current_user[0].name).toBe('Bob');
});
을
}}; 이 간단한 제어기위한
:
'use strict';
angular.module('maap').controller('profileCtrl', function($scope, UserService) {
$scope.current_user = UserService.details(0);
});
경고 또는 오류입니까? – madhured
@madhured 여기에 같은 문제가있는 – Tres