From 74dbec2d6637e036d3028b38459407a4bae4d9af Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Wed, 4 Sep 2019 23:32:49 -0400 Subject: [PATCH] registration error test --- .../registration-error-step.test.jsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/unit/components/registration-error-step.test.jsx diff --git a/test/unit/components/registration-error-step.test.jsx b/test/unit/components/registration-error-step.test.jsx new file mode 100644 index 000000000..e87e9b88a --- /dev/null +++ b/test/unit/components/registration-error-step.test.jsx @@ -0,0 +1,33 @@ +import React from 'react'; +import {shallowWithIntl} from '../../helpers/intl-helpers.jsx'; +import JoinFlowStep from '../../../src/components/join-flow/join-flow-step'; +import RegistrationErrorStep from '../../../src/components/join-flow/registration-error-step'; + +describe('RegistrationErrorStep', () => { + const onTryAgain = jest.fn(); + let wrapper; + + beforeEach(() => { + wrapper = shallowWithIntl( + + ); + }); + + test('shows JoinFlowStep with props', () => { + // Dive to get past the anonymous component. + const joinFlowStepWrapper = wrapper.dive().find(JoinFlowStep); + expect(joinFlowStepWrapper).toHaveLength(1); + expect(joinFlowStepWrapper.props().description).toBe('error message'); + expect(joinFlowStepWrapper.props().nextButton).toBe('general.tryAgain'); + }); + + test('when submitted, onTryAgain is called', () => { + // Dive to get past the anonymous component. + const joinFlowStepWrapper = wrapper.dive().find(JoinFlowStep); + joinFlowStepWrapper.props().onSubmit(new Event('event')); // eslint-disable-line no-undef + expect(onTryAgain).toHaveBeenCalled(); + }); +});