twenty/front/.storybook/preview.ts
gitstart-twenty 0fa55b0634
Fix Frontend modules tests (#2688)
* Fix naming issue

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix more tests

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Revert unnecessary changes

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Refactor according to self-review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix graphql mocks not working anymore

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2023-11-28 23:33:34 +01:00

46 lines
1.4 KiB
TypeScript

import { initialize, mswLoader } from 'msw-storybook-addon';
import { Preview } from '@storybook/react';
import { ThemeProvider } from '@emotion/react';
import { withThemeFromJSXProvider } from '@storybook/addon-styling';
import { lightTheme, darkTheme } from '../src/modules/ui/theme/constants/theme';
import { RootDecorator } from '../src/testing/decorators/RootDecorator';
import 'react-loading-skeleton/dist/skeleton.css';
import { mockedUserJWT } from '../src/testing/mock-data/jwt';
import { rest } from 'msw'
initialize();
const preview: Preview = {
decorators: [
withThemeFromJSXProvider({
themes: {
light: lightTheme,
dark: darkTheme,
},
defaultTheme: 'light',
Provider: ThemeProvider,
}),
RootDecorator,
],
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
cookie: {
tokenPair: `{%22accessToken%22:{%22token%22:%22${mockedUserJWT}%22%2C%22expiresAt%22:%222023-07-18T15:06:40.704Z%22%2C%22__typename%22:%22AuthToken%22}%2C%22refreshToken%22:{%22token%22:%22${mockedUserJWT}%22%2C%22expiresAt%22:%222023-10-15T15:06:41.558Z%22%2C%22__typename%22:%22AuthToken%22}%2C%22__typename%22:%22AuthTokenPair%22}`,
},
options: {
storySort: {
order: ['UI', 'Modules', 'Pages'],
},
},
},
loaders: [mswLoader],
};
export default preview;