2020-02-18 09:33:17 +00:00
|
|
|
import './index.js';
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
describe('vnTravelDescriptor', () => {
|
2020-02-18 09:33:17 +00:00
|
|
|
let controller;
|
2020-04-25 09:50:04 +00:00
|
|
|
let $httpBackend;
|
2020-02-18 09:33:17 +00:00
|
|
|
|
|
|
|
beforeEach(ngModule('travel'));
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
2020-02-18 09:33:17 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2020-04-30 10:48:52 +00:00
|
|
|
controller = $componentController('vnTravelDescriptor', {$element: null});
|
2020-04-25 09:50:04 +00:00
|
|
|
}));
|
2020-02-18 09:33:17 +00:00
|
|
|
|
|
|
|
describe('loadData()', () => {
|
|
|
|
it(`should perform a get query to store the worker data into the controller`, () => {
|
2020-04-25 09:50:04 +00:00
|
|
|
const id = 1;
|
|
|
|
const response = 'foo';
|
2020-02-18 09:33:17 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
$httpBackend.expectRoute('GET', `Travels/${id}`).respond(response);
|
2020-04-25 09:50:04 +00:00
|
|
|
controller.id = id;
|
2020-02-18 09:33:17 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.travel).toEqual(response);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|