From a427c0bbc9f057b0f2ae576db504fcd38d62fa63 Mon Sep 17 00:00:00 2001 From: Andrea Gueugnaut Date: Tue, 26 Nov 2024 15:48:24 +0100 Subject: [PATCH] fix(frontend): fix relative links --- .../AccountEmailActivationView.tsx | 2 +- .../AccountEmailCreationView.tsx | 2 +- .../test/AccountEmailCreationView.test.tsx | 30 +++++++++++-------- .../src/views/Account/AccountCreationView.tsx | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/frontend/src/views/Account/AccountCreation/AccountEmailActivationView.tsx b/frontend/src/views/Account/AccountCreation/AccountEmailActivationView.tsx index a54123dd6..0ec3f895c 100644 --- a/frontend/src/views/Account/AccountCreation/AccountEmailActivationView.tsx +++ b/frontend/src/views/Account/AccountCreation/AccountEmailActivationView.tsx @@ -25,7 +25,7 @@ function AccountEmailActivationView() { } if (!location.state?.email) { - return ; + return ; } const confirmationClasses = classNames(`fr-${status}-text`, { diff --git a/frontend/src/views/Account/AccountCreation/AccountEmailCreationView.tsx b/frontend/src/views/Account/AccountCreation/AccountEmailCreationView.tsx index 0425c9d59..78c169de6 100644 --- a/frontend/src/views/Account/AccountCreation/AccountEmailCreationView.tsx +++ b/frontend/src/views/Account/AccountCreation/AccountEmailCreationView.tsx @@ -34,7 +34,7 @@ function AccountEmailCreationView() { category: TrackEventCategories.AccountCreation, action: TrackEventActions.AccountCreation.SendEmail }); - navigate('activation', { + navigate('/inscription/activation', { state: { email } diff --git a/frontend/src/views/Account/AccountCreation/test/AccountEmailCreationView.test.tsx b/frontend/src/views/Account/AccountCreation/test/AccountEmailCreationView.test.tsx index 5d4f76f10..ca24523a5 100644 --- a/frontend/src/views/Account/AccountCreation/test/AccountEmailCreationView.test.tsx +++ b/frontend/src/views/Account/AccountCreation/test/AccountEmailCreationView.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { MemoryRouter as Router, Route } from 'react-router-dom'; +import { createMemoryRouter, Outlet, RouterProvider } from 'react-router-dom'; import AccountEmailCreationView from '../AccountEmailCreationView'; import userEvent from '@testing-library/user-event'; import { store } from '../../../../store/store'; @@ -9,19 +9,23 @@ describe('AccountEmailCreationView', () => { const user = userEvent.setup(); function setup() { + const router = createMemoryRouter( + [ + { + path: '/inscription/*', + element: , + children: [ + { path: 'email', element: }, + { path: 'activation', element: 'Activation' } + ] + } + ], + { initialEntries: ['/inscription/email'] } + ); render( - - - Activation - - Accueil - - - , + + ); } @@ -40,7 +44,7 @@ describe('AccountEmailCreationView', () => { await user.keyboard('{Enter}'); const error = await screen.findByText( - "L'adresse doit ĂȘtre un email valide", + "L'adresse doit ĂȘtre un email valide" ); expect(error).toBeVisible(); }); diff --git a/frontend/src/views/Account/AccountCreationView.tsx b/frontend/src/views/Account/AccountCreationView.tsx index 482ad1625..9b063af55 100644 --- a/frontend/src/views/Account/AccountCreationView.tsx +++ b/frontend/src/views/Account/AccountCreationView.tsx @@ -29,7 +29,7 @@ function AccountCreationView() { path="campagne" element={} /> - } /> + } />