import './index'; describe('Client', () => { describe('Component vnClientCard', () => { let controller; let $httpBackend; let data = {id: 1, name: 'fooName'}; beforeEach(ngModule('client')); beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { $httpBackend = _$httpBackend_; let $element = angular.element('
'); controller = $componentController('vnClientCard', {$element}); $stateParams.id = data.id; $httpBackend.whenRoute('GET', 'Clients/:id/getCard').respond(data); })); it('should request data and set it on the controller', () => { controller.$onInit(); $httpBackend.flush(); expect(controller.client).toEqual(data); }); }); });