Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ektaghag-eaton committed Sep 26, 2023
1 parent 76202b2 commit d7d9e78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@ import { CreatePasswordScreen } from './CreatePasswordScreen';
import { CreatePasswordScreenProps } from './types';
import {
RegistrationContextProvider,
RegistrationContextProviderProps,
i18nRegistrationInstance,
} from '../../contexts';
import { RegistrationWorkflow } from '../../components';

const defaultProps: RegistrationContextProviderProps = {
language: 'en',
i18n: i18nRegistrationInstance,
navigate: (): void => {},
routeConfig: {},
};
import { registrationContextProviderProps } from '../../testUtils';

const passwordRequirements = [
{
Expand Down Expand Up @@ -45,7 +37,7 @@ describe('Create Password Screen', () => {

const renderer = (props?: CreatePasswordScreenProps): RenderResult =>
render(
<RegistrationContextProvider {...defaultProps}>
<RegistrationContextProvider {...registrationContextProviderProps}>
<RegistrationWorkflow initialScreenIndex={0}>
<CreatePasswordScreen {...props} />
</RegistrationWorkflow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const ForgotPasswordScreenBase: React.FC<React.PropsWithChildren<ForgotPa
const validateEmail = (): boolean => typeof emailValidator(initialEmailValue) !== 'string';

const [isEmailValid, setIsEmailValid] = useState(validateEmail);
const [emailError, setEmailError] = useState(validateEmail() ? emailValidator(initialEmailValue) : '');
const [emailError, setEmailError] = useState(!validateEmail() ? emailValidator(initialEmailValue) : '');
const [shouldValidateEmail, setShouldValidateEmail] = useState(initialEmailValue !== '' ?? validateEmail);

const handleEmailInputChange = useCallback(
Expand Down

0 comments on commit d7d9e78

Please sign in to comment.