29 lines
843 B
JavaScript
29 lines
843 B
JavaScript
import './index';
|
|
|
|
describe('Client', () => {
|
|
describe('Component vnClientCard', () => {
|
|
let controller;
|
|
let $httpBackend;
|
|
let data = {id: 1, name: 'fooName'};
|
|
|
|
beforeEach(ngModule('client'));
|
|
|
|
beforeEach(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);
|
|
});
|
|
});
|
|
});
|