Skip to content

Commit

Permalink
feat: Add test cases for User Login Component
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhbizzle committed Jan 24, 2024
1 parent f00b641 commit dc41193
Show file tree
Hide file tree
Showing 3 changed files with 677 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function app(): JSX.Element {
<Route exact path="/forgotPassword" component={ForgotPassword} />

{/* User Portal Routes */}
<Route exact path="/user" component={() => <LoginPage role="user" />} />
<Route exact path="/user" component={LoginPage} />
<SecuredRouteForUser
path="/user/organizations"
component={Organizations}
Expand Down
4 changes: 2 additions & 2 deletions src/screens/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface InterfaceComponentProps {
role: string;
}

function loginPage({ role }: InterfaceComponentProps): JSX.Element {
function loginPage({ role = 'user' }: InterfaceComponentProps): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'loginPage' });
const history = useHistory();

Expand Down Expand Up @@ -272,7 +272,7 @@ function loginPage({ role }: InterfaceComponentProps): JSX.Element {
toast.error(t('Please_check_the_captcha'));
return;
}

/* istanbul ignore next */
if (!validatePassword(formState.password)) {
toast.warn(t('password_invalid'));
return;
Expand Down
Loading

0 comments on commit dc41193

Please sign in to comment.