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