2018-08-14 07:12:28 +00:00
|
|
|
import './index';
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
describe('vnClientDescriptor', () => {
|
2020-04-25 09:50:04 +00:00
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
2018-08-14 07:12:28 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2018-08-14 07:12:28 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
|
|
$httpBackend = _$httpBackend_;
|
2020-04-30 10:48:52 +00:00
|
|
|
controller = $componentController('vnClientDescriptor', {$element: null});
|
2020-04-25 09:50:04 +00:00
|
|
|
}));
|
2018-10-18 09:41:25 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
describe('loadData()', () => {
|
|
|
|
it(`should perform a get query to store the client data into the controller`, () => {
|
|
|
|
const id = 1;
|
|
|
|
const response = 'foo';
|
2018-10-18 09:41:25 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
$httpBackend.expectGET(`Clients/${id}/getCard`).respond(response);
|
|
|
|
controller.id = id;
|
|
|
|
$httpBackend.flush();
|
2018-08-14 07:12:28 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
expect(controller.client).toEqual(response);
|
2018-08-14 07:12:28 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|