salix/modules/client/front/recovery/create/index.spec.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import './index';
describe('Client', () => {
describe('Component vnClientRecoveryCreate', () => {
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();
}
};
}
};
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});
}));
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');
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('client.card.recovery.index');
});
});
});
});