-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add PaymentSuccess page stories
- Loading branch information
1 parent
ac072b2
commit f097e9f
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
packages/twenty-front/src/pages/auth/__stories__/PaymentSuccess.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |