2020-02-05 12:37:36 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('vnRouteDescriptorPopover', () => {
|
|
|
|
let controller;
|
2020-04-25 09:50:04 +00:00
|
|
|
let $httpBackend;
|
2020-02-05 12:37:36 +00:00
|
|
|
|
|
|
|
beforeEach(ngModule('route'));
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
2020-02-05 12:37:36 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2020-04-30 10:48:52 +00:00
|
|
|
controller = $componentController('vnRouteDescriptor', {$element: null});
|
2020-04-25 09:50:04 +00:00
|
|
|
}));
|
2020-02-05 12:37:36 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
describe('loadData()', () => {
|
2020-02-05 12:37:36 +00:00
|
|
|
it(`should perform a get query to store the client data into the controller`, () => {
|
2020-04-25 09:50:04 +00:00
|
|
|
const id = 1;
|
|
|
|
const response = 'foo';
|
2020-02-05 12:37:36 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
$httpBackend.expectRoute('GET', `Routes/${id}`).respond(response);
|
2020-04-25 09:50:04 +00:00
|
|
|
controller.id = id;
|
2020-02-05 12:37:36 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.route).toEqual(response);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|