From d7d9e78c6d950ba6c35f0530c2c04ac88aba322c Mon Sep 17 00:00:00 2001 From: ektaghag-eaton Date: Tue, 26 Sep 2023 17:46:56 +0530 Subject: [PATCH] Fix test cases --- .../CreatePasswordScreen.test.tsx | 12 ++---------- .../ForgotPasswordScreenBase.tsx | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/login-workflow/src/screens/CreatePasswordScreen/CreatePasswordScreen.test.tsx b/login-workflow/src/screens/CreatePasswordScreen/CreatePasswordScreen.test.tsx index e3c41a3d..c2ad1309 100644 --- a/login-workflow/src/screens/CreatePasswordScreen/CreatePasswordScreen.test.tsx +++ b/login-workflow/src/screens/CreatePasswordScreen/CreatePasswordScreen.test.tsx @@ -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 = [ { @@ -45,7 +37,7 @@ describe('Create Password Screen', () => { const renderer = (props?: CreatePasswordScreenProps): RenderResult => render( - + diff --git a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx index b6c910d4..e08c4708 100644 --- a/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx +++ b/login-workflow/src/screens/ForgotPasswordScreen/ForgotPasswordScreenBase.tsx @@ -58,7 +58,7 @@ export const ForgotPasswordScreenBase: React.FC 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(