import './index.js'; describe('Claim', () => { describe('Component vnClaimCard', () => { let controller; let $httpBackend; let data = {id: 1, name: 'fooName'}; beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); controller = $componentController('vnClaimCard', {$element}); $stateParams.id = data.id; $httpBackend.whenRoute('GET', 'Claims/:id').respond(data); })); it('should request data and set it on the controller', () => { controller.reload(); $httpBackend.flush(); expect(controller.claim).toEqual(data); }); }); });