2018-05-23 12:26:51 +00:00
|
|
|
import './index';
|
2018-03-01 10:55:28 +00:00
|
|
|
|
|
|
|
describe('Client', () => {
|
|
|
|
describe('Component vnClientRecoveryCreate', () => {
|
|
|
|
let $scope;
|
|
|
|
let $state;
|
|
|
|
let controller;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2018-03-01 10:55:28 +00:00
|
|
|
|
2020-07-23 14:46:16 +00:00
|
|
|
beforeEach(inject(($componentController, $rootScope, _$state_) => {
|
2018-03-01 10:55:28 +00:00
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$state = _$state_;
|
|
|
|
$scope.watcher = {
|
|
|
|
submit: () => {
|
|
|
|
return {
|
|
|
|
then: callback => {
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2020-03-17 10:17:50 +00:00
|
|
|
const $element = angular.element('<vn-client-recovery-create></vn-client-recovery-create>');
|
|
|
|
controller = $componentController('vnClientRecoveryCreate', {$element, $scope});
|
2018-03-01 10:55:28 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
describe('onSubmit()', () => {
|
|
|
|
it('should call the function go() on $state to go to the recovery list', () => {
|
2020-02-26 12:22:52 +00:00
|
|
|
jest.spyOn($state, 'go');
|
2018-03-01 10:55:28 +00:00
|
|
|
controller.onSubmit();
|
|
|
|
|
2018-05-24 13:02:38 +00:00
|
|
|
expect(controller.$state.go).toHaveBeenCalledWith('client.card.recovery.index');
|
2018-03-01 10:55:28 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|