diff --git a/client/src/actions/__tests__/session-actions-test.js b/client/src/actions/__tests__/session-actions-test.js
index 3f0c335e..a5dc62f9 100644
--- a/client/src/actions/__tests__/session-actions-test.js
+++ b/client/src/actions/__tests__/session-actions-test.js
@@ -1,7 +1,9 @@
const sessionStoreMock = require('lib-app/__mocks__/session-store-mock');
const APICallMock = require('lib-app/__mocks__/api-call-mock');
const storeMock = {
- dispatch: stub()
+ dispatch: stub().returns({
+ then: stub()
+ })
};
const SessionActions = requireUnit('actions/session-actions', {
@@ -158,4 +160,4 @@ describe('Session Actions,', function () {
expect(storeMock.dispatch).to.have.been.calledWith(SessionActions.autoLogin());
});
});
-});
\ No newline at end of file
+});
diff --git a/client/src/app-components/__tests__/password-recovery-test.js b/client/src/app-components/__tests__/password-recovery-test.js
deleted file mode 100644
index 906a2624..00000000
--- a/client/src/app-components/__tests__/password-recovery-test.js
+++ /dev/null
@@ -1,91 +0,0 @@
-const APICallMock = require('lib-app/__mocks__/api-call-mock');
-
-const SubmitButton = ReactMock();
-const Button = ReactMock();
-const Input = ReactMock();
-const Form = ReactMock();
-const Checkbox = ReactMock();
-const Message = ReactMock();
-const FormField = ReactMock();
-const Widget = ReactMock();
-
-const PasswordRecovery = requireUnit('app-components/password-recovery', {
- 'lib-app/api-call': APICallMock,
- 'core-components/submit-button': SubmitButton,
- 'core-components/button': Button,
- 'core-components/form-field': FormField,
- 'core-components/': FormField,
- 'core-components/form': Form,
- 'core-components/checkbox': Checkbox,
- 'core-components/message': Message,
- 'core-components/widget': Widget,
-});
-
-describe('PasswordRecovery component', function () {
- let recoverWidget, recoverForm, widgetTransition, emailInput, component,
- backToLoginButton, submitButton;
-
- let dispatch = stub();
-
- beforeEach(function () {
- component = TestUtils.renderIntoDocument(
-
- );
- recoverWidget = TestUtils.scryRenderedComponentsWithType(component, Widget)[0];
- recoverForm = TestUtils.scryRenderedComponentsWithType(component, Form)[0];
- emailInput = TestUtils.scryRenderedComponentsWithType(component, Input)[0];
- submitButton = TestUtils.scryRenderedComponentsWithType(component, SubmitButton)[0];
- backToLoginButton = TestUtils.scryRenderedComponentsWithType(component, Button)[0];
- });
-
- it('should control form errors by prop', function () {
- expect(recoverForm.props.errors).to.deep.equal({});
- recoverForm.props.onValidateErrors({email: 'MOCK_ERROR'});
- expect(recoverForm.props.errors).to.deep.equal({email: 'MOCK_ERROR'});
- });
-
- it('should call sendRecoverPassword when submitted', function () {
- let mockSubmitData = {email: 'MOCK_VALUE'};
- APICallMock.call.reset();
-
- recoverForm.props.onSubmit(mockSubmitData);
- expect(APICallMock.call).to.have.been.calledWith({
- path: '/user/send-recover-password',
- data: mockSubmitData
- });
- });
-
- it('should set loading true in the form when submitted', function () {
- let mockSubmitData = {email: 'MOCK_VALUE'};
-
- recoverForm.props.onSubmit(mockSubmitData);
- expect(recoverForm.props.loading).to.equal(true);
- });
-
- it('should add error and stop loading when send recover fails', function () {
- component.refs.recoverForm.refs.email.focus.reset();
-
- component.onRecoverPasswordFail();
- expect(recoverForm.props.errors).to.deep.equal({email: 'EMAIL_NOT_EXIST'});
- expect(recoverForm.props.loading).to.equal(false);
- expect(component.refs.recoverForm.refs.email.focus).to.have.been.called;
- });
-
- it('should show message when send recover success', function () {
- let message = TestUtils.scryRenderedComponentsWithType(component, Message)[0];
- expect(message).to.equal(undefined);
-
- component.onRecoverPasswordSent();
- message = TestUtils.scryRenderedComponentsWithType(component, Message)[0];
-
- expect(recoverForm.props.loading).to.equal(false);
- expect(message).to.not.equal(null);
- expect(message.props.type).to.equal('info');
- expect(message.props.children).to.equal('RECOVER_SENT');
- });
-
- it('should show front side if \'Back to login form\' link is clicked', function () {
- backToLoginButton.props.onClick();
- expect(widgetTransition.props.sideToShow).to.equal('front');
- });
-});
diff --git a/client/src/app-components/password-recovery.js b/client/src/app-components/password-recovery.js
index aa667254..60ec0489 100644
--- a/client/src/app-components/password-recovery.js
+++ b/client/src/app-components/password-recovery.js
@@ -31,7 +31,7 @@ class PasswordRecovery extends React.Component {
{this.renderLogo()}