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