Write unit tests for new components and functions introduced in admin/preview update
The code introduced by the latest membership portal feature affects many areas of the web app, including auth.
We should have automated testing for these new components and functions introduced to ensure stability when adding more features in the future.
A list of updated or new components and hooks to be tested, but not limited to:
-
<Protected>
-
<ProtectedRoute>
-
<PreviewAutocomplete>
-
<OrganizationAutocomplete>
-
usePreviewMode
We should also test the authentication logic within <Portal>
(mainly the redirect logic). However, that currently isn't very testable (huge aggregate component, network requests, etc.). This logic should be extracted into a custom hook and have that be tested instead.
Edited by Olivier Goulet