mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
registration error test
This commit is contained in:
parent
aec4d90201
commit
74dbec2d66
1 changed files with 33 additions and 0 deletions
33
test/unit/components/registration-error-step.test.jsx
Normal file
33
test/unit/components/registration-error-step.test.jsx
Normal file
|
@ -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(
|
||||
<RegistrationErrorStep
|
||||
errorMsg={'error message'}
|
||||
onTryAgain={onTryAgain}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue