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:
@ -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>
|
||||
);
|
||||
|
||||
9
front/src/testing/decorators/RelationPickerDecorator.tsx
Normal file
9
front/src/testing/decorators/RelationPickerDecorator.tsx
Normal 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>
|
||||
);
|
||||
9
front/src/testing/decorators/SnackBarDecorator.tsx
Normal file
9
front/src/testing/decorators/SnackBarDecorator.tsx
Normal 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
Reference in New Issue
Block a user