salix/modules/client/front/descriptor/index.spec.js

27 lines
755 B
JavaScript

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