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

29 lines
856 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
2019-11-10 10:08:44 +00:00
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);
}));
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
});
});