2023-11-29 01:33:34 +03:00
|
|
|
import { initialize, mswLoader } from 'msw-storybook-addon';
|
2023-05-29 12:02:38 +03:00
|
|
|
import { Preview } from '@storybook/react';
|
2023-06-05 23:20:55 +03:00
|
|
|
import { ThemeProvider } from '@emotion/react';
|
2023-07-14 01:03:23 +03:00
|
|
|
import { withThemeFromJSXProvider } from '@storybook/addon-styling';
|
2023-07-31 04:26:32 +03:00
|
|
|
import { lightTheme, darkTheme } from '../src/modules/ui/theme/constants/theme';
|
2023-07-24 10:57:56 +03:00
|
|
|
import { RootDecorator } from '../src/testing/decorators/RootDecorator';
|
2023-07-22 08:07:11 +03:00
|
|
|
import 'react-loading-skeleton/dist/skeleton.css';
|
2023-07-22 08:05:45 +03:00
|
|
|
import { mockedUserJWT } from '../src/testing/mock-data/jwt';
|
2023-11-29 01:33:34 +03:00
|
|
|
import { rest } from 'msw'
|
2023-07-25 21:00:15 +03:00
|
|
|
|
2023-05-29 12:02:38 +03:00
|
|
|
initialize();
|
|
|
|
|
|
|
|
const preview: Preview = {
|
2023-06-05 23:20:55 +03:00
|
|
|
decorators: [
|
|
|
|
withThemeFromJSXProvider({
|
2023-07-14 01:03:23 +03:00
|
|
|
themes: {
|
|
|
|
light: lightTheme,
|
|
|
|
dark: darkTheme,
|
|
|
|
},
|
|
|
|
defaultTheme: 'light',
|
|
|
|
Provider: ThemeProvider,
|
|
|
|
}),
|
|
|
|
RootDecorator,
|
2023-06-05 23:20:55 +03:00
|
|
|
],
|
2023-05-29 12:02:38 +03:00
|
|
|
parameters: {
|
|
|
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
|
|
controls: {
|
|
|
|
matchers: {
|
|
|
|
color: /(background|color)$/i,
|
|
|
|
date: /Date$/,
|
|
|
|
},
|
|
|
|
},
|
2023-07-22 08:05:45 +03:00
|
|
|
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}`,
|
|
|
|
},
|
2023-07-18 03:14:53 +03:00
|
|
|
options: {
|
|
|
|
storySort: {
|
|
|
|
order: ['UI', 'Modules', 'Pages'],
|
|
|
|
},
|
|
|
|
},
|
2023-05-29 12:02:38 +03:00
|
|
|
},
|
2023-11-29 01:33:34 +03:00
|
|
|
loaders: [mswLoader],
|
2023-05-29 12:02:38 +03:00
|
|
|
};
|
|
|
|
|
2023-07-14 01:03:23 +03:00
|
|
|
export default preview;
|