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

29 lines
856 B
JavaScript

import './index';
describe('Client', () => {
describe('Component vnClientCard', () => {
let controller;
let $httpBackend;
let data = {id: 1, name: 'fooName'};
beforeEach(ngModule('client'));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnClientCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'Clients/:id/getCard').respond(data);
}));
it('should request data and set it on the controller', () => {
controller.$onInit();
$httpBackend.flush();
expect(controller.client).toEqual(data);
});
});
});