Increase storybook pages coverage (#4885)

On FE:
- refreshing metadata mocks
- updating jest tests
- fixing storybook pages coverage
- fixing storybook modules coverage
This commit is contained in:
Charles Bochet
2024-04-17 16:24:04 +02:00
committed by GitHub
parent 6804a90f2f
commit 75fd430149
46 changed files with 13679 additions and 7354 deletions

View File

@ -1,4 +1,5 @@
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
@ -7,6 +8,7 @@ import {
PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { sleep } from '~/testing/sleep';
import { SettingsAccountsCalendars } from '../SettingsAccountsCalendars';
@ -27,4 +29,11 @@ export default meta;
export type Story = StoryObj<typeof SettingsAccountsCalendars>;
export const Default: Story = {};
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
sleep(100);
await canvas.findByText('Calendar settings');
},
};

View File

@ -1,4 +1,6 @@
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';
import { graphql, HttpResponse } from 'msw';
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
@ -8,6 +10,7 @@ import {
} from '~/testing/decorators/PageDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { mockedConnectedAccounts } from '~/testing/mock-data/accounts';
import { sleep } from '~/testing/sleep';
import { SettingsAccountsCalendarsSettings } from '../SettingsAccountsCalendarsSettings';
@ -21,7 +24,26 @@ const meta: Meta<PageDecoratorArgs> = {
},
parameters: {
layout: 'fullscreen',
msw: graphqlMocks,
msw: {
handlers: [
...graphqlMocks.handlers,
graphql.query('FindOneCalendarChannel', () => {
return HttpResponse.json({
data: {
calendarChannel: {
edges: [],
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
});
}),
],
},
},
};
@ -29,4 +51,11 @@ export default meta;
export type Story = StoryObj<typeof SettingsAccountsCalendarsSettings>;
export const Default: Story = {};
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
sleep(100);
await canvas.findByText('Event visibility');
},
};