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

29 lines
843 B
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import './index';
2017-08-30 14:05:34 +00:00
describe('Client', () => {
describe('Component vnClientCard', () => {
let controller;
2019-11-10 10:08:44 +00:00
let $httpBackend;
let data = {id: 1, name: 'fooName'};
2017-08-30 14:05:34 +00:00
beforeEach(ngModule('client'));
2017-08-30 14:05:34 +00:00
2020-07-23 14:46:16 +00:00
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
2019-11-10 10:08:44 +00:00
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnClientCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'Clients/:id/getCard').respond(data);
}));
2017-08-30 14:05:34 +00:00
2019-11-10 10:08:44 +00:00
it('should request data and set it on the controller', () => {
controller.$onInit();
$httpBackend.flush();
expect(controller.client).toEqual(data);
});
2017-08-30 14:05:34 +00:00
});
});