Skip to content

Commit

Permalink
✨ (EventPassList.stories.tsx): streamline story by focusing on releva…
Browse files Browse the repository at this point in the history
…nt interactions

♻️ (OffKeyInfo.stories.tsx): separate OffKeyInfoSkeleton import for clarity
🔥 (test-utils/functions): remove unused test-utils library to clean up project
✨ (.storybook/main.ts): enable SWC for Storybook to improve build performance
♻️ (Button.stories.tsx): replace delayData with sleep for consistency in utils usage

♻️ (button/examples.tsx): replace `delayData` with `sleep` for consistency
🔧 (tsconfig.base.json): remove `@test-utils/functions` path to clean up unused dependencies
  • Loading branch information
sebpalluel committed Apr 26, 2024
1 parent f630df8 commit 2fef9d6
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ export const Default: Story = {
export const Opened: Story = {
...Default,
play: async () => {
await userEvent.click(
await screen.findByRole('button', {
name: /Lorem ipsum/i,
}),
);
await screen.findByText(/6 x/i);
await screen.findByText(/General Admission/i);
await userEvent.click(
await screen.findByRole('button', {
name: /World cup/i,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { OffKeyState } from '@next/iframe';
import { StoryObj, type Meta } from '@storybook/react';
import React from 'react';
import { OffKeyInfo, OffKeyInfoSkeleton } from './OffKeyInfo';
import { OffKeyInfo } from './OffKeyInfo';
import { OffKeyInfoSkeleton } from './OffKeyInfoSkeleton';

const meta = {
component: OffKeyInfo,
Expand Down
18 changes: 0 additions & 18 deletions libs/test-utils/functions/.eslintrc.json

This file was deleted.

29 changes: 0 additions & 29 deletions libs/test-utils/functions/.swcrc

This file was deleted.

11 changes: 0 additions & 11 deletions libs/test-utils/functions/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions libs/test-utils/functions/jest.config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions libs/test-utils/functions/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions libs/test-utils/functions/project.json

This file was deleted.

1 change: 0 additions & 1 deletion libs/test-utils/functions/src/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions libs/test-utils/functions/src/lib/delay.ts

This file was deleted.

24 changes: 0 additions & 24 deletions libs/test-utils/functions/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions libs/test-utils/functions/tsconfig.lib.json

This file was deleted.

9 changes: 0 additions & 9 deletions libs/test-utils/functions/tsconfig.spec.json

This file was deleted.

18 changes: 0 additions & 18 deletions libs/ui/components/.babelrc

This file was deleted.

13 changes: 12 additions & 1 deletion libs/ui/components/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@ module.exports = {
},
framework: {
name: '@storybook/react-webpack5',
options: {},
options: {
builder: { useSWC: true },
},
},
swc: (config, options) => ({
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
}),
docs: {
autodocs: true,
},
Expand Down
3 changes: 1 addition & 2 deletions libs/ui/components/src/lib/button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
waitForElementToBeRemoved,
within,
} from '@storybook/test';
import { delayData } from '@test-utils/functions';
import { Settings } from '@ui/icons';

import { sleep } from '@utils';
Expand Down Expand Up @@ -54,7 +53,7 @@ type Story = StoryObj<typeof meta>;
export const DefaultButton = {
args: {
children: 'Button with Click and Loading',
onClick: () => delayData(1000, null),
onClick: () => sleep(1000),
},
play: async ({ canvasElement, controls }) => {
const canvas = within(canvasElement);
Expand Down
6 changes: 3 additions & 3 deletions libs/ui/components/src/lib/button/examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
buttonSizes,
type ButtonProps,
} from './Button';
import { delayData } from '@test-utils/functions';
import { sleep } from '@utils';
import { OutlineArrowRight } from '@ui/icons';

export const variantOptions = Object.keys(buttonVariants);
Expand Down Expand Up @@ -65,7 +65,7 @@ export const AllbuttonVariantsLoadingComponent: React.FC<
key={variant}
size={size}
variant={variant as keyof typeof buttonVariants}
onClick={() => delayData(3000, null)}
onClick={() => sleep(3000)}
isLoading
>
{variant} Loading
Expand All @@ -83,7 +83,7 @@ export const AllbuttonSizesLoadingComponent: React.FC<
key={size}
size={size as keyof typeof buttonSizes}
variant={variant}
onClick={() => delayData(3000, null)}
onClick={() => sleep(3000)}
isLoading
>
{size} Loading
Expand Down
1 change: 0 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
"@smart-wallet/admin": ["libs/smart-wallet/admin/src/index.ts"],
"@test-utils/cache": ["libs/test-utils/cache/src/index.ts"],
"@test-utils/db": ["libs/test-utils/db/src/index.ts"],
"@test-utils/functions": ["libs/test-utils/functions/src/index.ts"],
"@test-utils/gql": ["libs/test-utils/gql/src/index.ts"],
"@test-utils/hasura": ["libs/test-utils/hasura/src/index.ts"],
"@test-utils/next-intl": ["libs/test-utils/next-intl/src/index.tsx"],
Expand Down

0 comments on commit 2fef9d6

Please sign in to comment.