Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/AuthRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@ import EmailRegistration from '@/views/EmailRegistration';
import VerifyMagicLink from '@/views/VerifyMagicLink';
import MagicLinkSent from './components/MagicLinkSent';

/**
*The camel case routes will depreciated in a future version please start using the kebab case instead.
*
*'/passKeyLogin', '/verifyPhoneOTP', '/verifyEmailOTP', '/registerPasskey' will be depricated in a future version
*
*Please use "/pass-key-login", "/verify-phone-otp", "/verify-email-otp", "/register-passkey" respectively.
*
*/
export const AuthRoutes = () => (
<Routes>
<Route path="/login" element={<Login />} />
<Route path="/passKeyLogin" element={<PassKeyLogin />} />
<Route path="/pass-key-login" element={<PassKeyLogin />} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make passkey one word.

<Route path="/verifyPhoneOTP" element={<PhoneRegistration />} />
<Route path="/verify-phone-otp" element={<PhoneRegistration />} />
<Route path="/verifyEmailOTP" element={<EmailRegistration />} />
<Route path="/verify-email-otp" element={<EmailRegistration />} />
<Route path="/verify-magiclink" element={<VerifyMagicLink />} />
<Route path="/registerPasskey" element={<PasskeyRegistration />} />
<Route path="/register-passkey" element={<PasskeyRegistration />} />
<Route path="/magiclinks-sent" element={<MagicLinkSent />} />
<Route path="*" element={<Navigate to="/login" replace />} />
</Routes>
Expand Down
18 changes: 18 additions & 0 deletions tests/AuthRoutes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ describe('AuthRoutes', () => {
expect(screen.getByText('Passkey Login Page')).toBeInTheDocument();
});

it('renders Passkey Login page on /pass-key-login', () => {
render(
<MemoryRouter initialEntries={['/passKeyLogin']}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this test should it be /pass-key-login?

<AuthRoutes />
</MemoryRouter>
);
expect(screen.getByText('Passkey Login Page')).toBeInTheDocument();
});

it('renders Register Passkey page on /registerPasskey', () => {
render(
<MemoryRouter initialEntries={['/registerPasskey']}>
Expand All @@ -50,6 +59,15 @@ describe('AuthRoutes', () => {
expect(screen.getByText('Verify Phone Page')).toBeInTheDocument();
});

it('renders Phone OTP page on /verify-phone-otp', () => {
render(
<MemoryRouter initialEntries={['/verify-phone-otp']}>
<AuthRoutes />
</MemoryRouter>
);
expect(screen.getByText('Verify Phone Page')).toBeInTheDocument();
});

it('redirects unknown routes to /login', () => {
render(
<MemoryRouter initialEntries={['/some/unknown/route']}>
Expand Down
Loading