import './index.js'; describe('vnTravelDescriptor', () => { let controller; let $httpBackend; beforeEach(ngModule('travel')); beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; controller = $componentController('vnTravelDescriptor', {$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', `Travels/${id}`).respond(response); controller.id = id; $httpBackend.flush(); expect(controller.travel).toEqual(response); }); }); });