Fix Frontend pages tests (#2719)

* Fix Frontend pages tests

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>

* Add SnackBarDecorator

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>

* Fix more tests

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>

* Fix more tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
gitstart-twenty
2023-11-27 15:52:16 +05:45
committed by GitHub
parent f0e20b06df
commit 9648b13703
10 changed files with 72 additions and 28 deletions

View File

@ -1,7 +1,10 @@
import { HelmetProvider } from 'react-helmet-async';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { Decorator } from '@storybook/react';
import { RecoilRoot } from 'recoil';
import { SnackBarProviderScope } from '@/ui/feedback/snack-bar-manager/scopes/SnackBarProviderScope';
import { RelationPickerScope } from '@/ui/input/components/internal/relation-picker/scopes/RelationPickerScope';
import { ClientConfigProvider } from '~/modules/client-config/components/ClientConfigProvider';
import { DefaultLayout } from '~/modules/ui/layout/page/DefaultLayout';
import { UserProvider } from '~/modules/users/components/UserProvider';
@ -30,21 +33,27 @@ export const PageDecorator: Decorator<{
routePath: string;
routeParams: RouteParams;
}> = (Story, { args }) => (
<UserProvider>
<ClientConfigProvider>
<MemoryRouter
initialEntries={[computeLocation(args.routePath, args.routeParams)]}
>
<FullHeightStorybookLayout>
<HelmetProvider>
<DefaultLayout>
<Routes>
<Route path={args.routePath} element={<Story />} />
</Routes>
</DefaultLayout>
</HelmetProvider>
</FullHeightStorybookLayout>
</MemoryRouter>
</ClientConfigProvider>
</UserProvider>
<RecoilRoot>
<UserProvider>
<ClientConfigProvider>
<MemoryRouter
initialEntries={[computeLocation(args.routePath, args.routeParams)]}
>
<FullHeightStorybookLayout>
<HelmetProvider>
<SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager">
<RelationPickerScope relationPickerScopeId="relation-picker">
<DefaultLayout>
<Routes>
<Route path={args.routePath} element={<Story />} />
</Routes>
</DefaultLayout>
</RelationPickerScope>
</SnackBarProviderScope>
</HelmetProvider>
</FullHeightStorybookLayout>
</MemoryRouter>
</ClientConfigProvider>
</UserProvider>
</RecoilRoot>
);

View File

@ -0,0 +1,9 @@
import { Decorator } from '@storybook/react';
import { RelationPickerScope } from '@/ui/input/components/internal/relation-picker/scopes/RelationPickerScope';
export const RelationPickerDecorator: Decorator = (Story) => (
<RelationPickerScope relationPickerScopeId="relation-picker">
<Story />
</RelationPickerScope>
);

View File

@ -0,0 +1,9 @@
import { Decorator } from '@storybook/react';
import { SnackBarProviderScope } from '@/ui/feedback/snack-bar-manager/scopes/SnackBarProviderScope';
export const SnackBarDecorator: Decorator = (Story) => (
<SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager">
<Story />
</SnackBarProviderScope>
);

File diff suppressed because one or more lines are too long