mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Add Storybook stories for the new brewery detail page components
This commit is contained in:
37
web/frontend/stories/CommunityStatsCard.stories.tsx
Normal file
37
web/frontend/stories/CommunityStatsCard.stories.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import { expect, within } from 'storybook/test';
|
||||
import CommunityStatsCard from '../app/features/breweries/components/CommunityStatsCard';
|
||||
|
||||
const communityStatsCardDescription = `Sidebar "Community" card: live likes/ratings/comments counts, kept in sync with the header, your-rating, and comments cards on the brewery detail page.`;
|
||||
|
||||
const meta = {
|
||||
title: 'Breweries/CommunityStatsCard',
|
||||
component: CommunityStatsCard,
|
||||
tags: ['autodocs'],
|
||||
args: {
|
||||
likeCount: 127,
|
||||
ratingsCount: 76,
|
||||
commentCount: 3,
|
||||
},
|
||||
parameters: {
|
||||
layout: 'padded',
|
||||
docs: {
|
||||
description: {
|
||||
component: communityStatsCardDescription,
|
||||
},
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof CommunityStatsCard>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await expect(canvas.getByText('Likes')).toBeInTheDocument();
|
||||
await expect(canvas.getByText('127')).toBeInTheDocument();
|
||||
await expect(canvas.getByText('76')).toBeInTheDocument();
|
||||
await expect(canvas.getByText('3')).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user