Skip to content

Commit

Permalink
docs: add PaymentSuccess page stories
Browse files Browse the repository at this point in the history
  • Loading branch information
thaisguigon committed Mar 25, 2024
1 parent ac072b2 commit f097e9f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { getOperationName } from '@apollo/client/utilities';
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/testing-library';
import { graphql, HttpResponse } from 'msw';

import { AppPath } from '@/types/AppPath';
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import {
PageDecorator,
PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { mockedOnboardingUsersData } from '~/testing/mock-data/users';

import { PaymentSuccess } from '../PaymentSuccess';

const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/Auth/PaymentSuccess',
component: PaymentSuccess,
decorators: [PageDecorator],
args: { routePath: AppPath.PlanRequiredSuccess },
parameters: {
msw: {
handlers: [
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => {
return HttpResponse.json({
data: {
currentUser: mockedOnboardingUsersData[0],
},
});
}),
graphqlMocks.handlers,
],
},
},
};

export default meta;

export type Story = StoryObj<typeof PaymentSuccess>;

export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await canvas.findByText('Start');
},
};

0 comments on commit f097e9f

Please sign in to comment.