37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import './index';
|
|
|
|
describe('Client', () => {
|
|
describe('Component vnClientGreugeCreate', () => {
|
|
let $scope;
|
|
let $state;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('client'));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
|
|
$scope = $rootScope.$new();
|
|
$state = _$state_;
|
|
$scope.watcher = {
|
|
submit: () => {
|
|
return {
|
|
then: callback => {
|
|
callback();
|
|
}
|
|
};
|
|
}
|
|
};
|
|
const $element = angular.element('<vn-client-greuge-create></vn-client-greuge-create>');
|
|
controller = $componentController('vnClientGreugeCreate', {$element, $scope});
|
|
}));
|
|
|
|
describe('onSubmit()', () => {
|
|
it('should call the function go() on $state to go to the greuges list', () => {
|
|
jest.spyOn($state, 'go');
|
|
controller.onSubmit();
|
|
|
|
expect(controller.$state.go).toHaveBeenCalledWith('client.card.greuge.index');
|
|
});
|
|
});
|
|
});
|
|
});
|