import './index.js'; describe('vnWorkerDescriptor', () => { let controller; let $httpBackend; beforeEach(ngModule('worker')); beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; controller = $componentController('vnWorkerDescriptor', {$element: null}); })); describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { const id = 1; const response = 'foo'; $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); controller.id = id; $httpBackend.flush(); expect(controller.worker).toEqual(response); }); }); });