From cdd90da423e59e825983858748617f85b29ba783 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Thu, 19 Sep 2019 13:40:09 -0400 Subject: [PATCH] Rename error function. --- src/components/join-flow/email-step.jsx | 4 ++-- src/components/join-flow/join-flow.jsx | 6 +++--- test/unit/components/email-step.test.jsx | 8 ++++---- test/unit/components/join-flow.test.jsx | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/join-flow/email-step.jsx b/src/components/join-flow/email-step.jsx index 15ae71872..803bd1bf8 100644 --- a/src/components/join-flow/email-step.jsx +++ b/src/components/join-flow/email-step.jsx @@ -56,7 +56,7 @@ class EmailStep extends React.Component { this.emailInput = emailInputRef; } onCaptchaError () { - this.props.onMidRegistrationError( + this.props.onRegistrationError( this.props.intl.formatMessage({ id: 'registation.troubleReload' }) @@ -211,8 +211,8 @@ class EmailStep extends React.Component { EmailStep.propTypes = { intl: intlShape, - onMidRegistrationError: PropTypes.func, onNextStep: PropTypes.func, + onRegistrationError: PropTypes.func, waiting: PropTypes.bool }; diff --git a/src/components/join-flow/join-flow.jsx b/src/components/join-flow/join-flow.jsx index 5eb8641be..6849531e6 100644 --- a/src/components/join-flow/join-flow.jsx +++ b/src/components/join-flow/join-flow.jsx @@ -23,7 +23,7 @@ class JoinFlow extends React.Component { super(props); bindAll(this, [ 'handleAdvanceStep', - 'handleMidRegistrationError', + 'handleRegistrationError', 'handlePrepareToRegister', 'handleRegistrationResponse', 'handleSubmitRegistration' @@ -35,7 +35,7 @@ class JoinFlow extends React.Component { waiting: false }; } - handleMidRegistrationError (message) { + handleRegistrationError (message) { if (!message) { message = this.props.intl.formatMessage({ id: 'registration.generalError' @@ -151,8 +151,8 @@ class JoinFlow extends React.Component { { test('onCaptchaError calls error function with correct message', () => { const props = { - onMidRegistrationError: jest.fn() + onRegistrationError: jest.fn() }; const wrapper = shallowWithIntl( @@ -132,12 +132,12 @@ describe('EmailStep test', () => { const formikWrapper = wrapper.dive(); formikWrapper.instance().onCaptchaError(); - expect(props.onMidRegistrationError).toHaveBeenCalledWith('registation.troubleReload'); + expect(props.onRegistrationError).toHaveBeenCalledWith('registation.troubleReload'); }); test('Captcha load error calls error function', () => { const props = { - onMidRegistrationError: jest.fn() + onRegistrationError: jest.fn() }; // Set this to null to force an error. global.grecaptcha = null; @@ -148,7 +148,7 @@ describe('EmailStep test', () => { const formikWrapper = wrapper.dive(); formikWrapper.instance().onCaptchaLoad(); - expect(props.onMidRegistrationError).toHaveBeenCalledWith('registation.troubleReload'); + expect(props.onRegistrationError).toHaveBeenCalledWith('registation.troubleReload'); }); test('validateEmail test email empty', () => { diff --git a/test/unit/components/join-flow.test.jsx b/test/unit/components/join-flow.test.jsx index 2714ae317..04cb1a6dc 100644 --- a/test/unit/components/join-flow.test.jsx +++ b/test/unit/components/join-flow.test.jsx @@ -126,17 +126,17 @@ describe('JoinFlow', () => { expect(joinFlowInstance.props.refreshSession).not.toHaveBeenCalled(); expect(joinFlowInstance.state.registrationError).toBe('registration.generalError (400)'); }); - test('handleMidRegistrationError with no message ', () => { + test('handleRegistrationError with no message ', () => { const joinFlowInstance = getJoinFlowWrapper().instance(); joinFlowInstance.setState({}); - joinFlowInstance.handleMidRegistrationError(); + joinFlowInstance.handleRegistrationError(); expect(joinFlowInstance.state.registrationError).toBe('registration.generalError'); }); - test('handleMidRegistrationError with message ', () => { + test('handleRegistrationError with message ', () => { const joinFlowInstance = getJoinFlowWrapper().instance(); joinFlowInstance.setState({}); - joinFlowInstance.handleMidRegistrationError('my message'); + joinFlowInstance.handleRegistrationError('my message'); expect(joinFlowInstance.state.registrationError).toBe('my message'); });