Fix and enhance storybook:pages tests (#3085)
* Fix and enhance storybook:pages tests Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix and enhance storybook:pages tests Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * fix SettingsObjectFieldPreview Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix lint Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix jest Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Add more fixes Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix App.stories.tsx Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix tests * Fix according to review --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,14 +1,17 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
||||
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { CommandType } from '@/command-menu/types/Command';
|
||||
import { IconCheckbox, IconNotes } from '@/ui/display/icon';
|
||||
import { SnackBarProviderScope } from '@/ui/feedback/snack-bar-manager/scopes/SnackBarProviderScope';
|
||||
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
|
||||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
|
||||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { mockDefaultWorkspace } from '~/testing/mock-data/users';
|
||||
import { sleep } from '~/testing/sleep';
|
||||
|
||||
import { CommandMenu } from '../CommandMenu';
|
||||
@ -20,11 +23,13 @@ const meta: Meta<typeof CommandMenu> = {
|
||||
component: CommandMenu,
|
||||
decorators: [
|
||||
ObjectMetadataItemsDecorator,
|
||||
ComponentWithRouterDecorator,
|
||||
(Story) => {
|
||||
const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
|
||||
const { addToCommandMenu, setToIntitialCommandMenu, toggleCommandMenu } =
|
||||
useCommandMenu();
|
||||
|
||||
setCurrentWorkspace(mockDefaultWorkspace);
|
||||
|
||||
useEffect(() => {
|
||||
setToIntitialCommandMenu();
|
||||
addToCommandMenu([
|
||||
@ -50,7 +55,14 @@ const meta: Meta<typeof CommandMenu> = {
|
||||
|
||||
return <Story />;
|
||||
},
|
||||
SnackBarDecorator,
|
||||
(Story) => (
|
||||
<RecoilRoot>
|
||||
<SnackBarProviderScope snackBarManagerScopeId="snack-bar-manager">
|
||||
<Story />
|
||||
</SnackBarProviderScope>
|
||||
</RecoilRoot>
|
||||
),
|
||||
ComponentWithRouterDecorator,
|
||||
],
|
||||
parameters: {
|
||||
msw: graphqlMocks,
|
||||
|
||||
Reference in New Issue
Block a user