import React from 'react'; import { composeStories } from '@storybook/react-vite'; import { render as testRender } from '../../../../vitest/render'; import * as stories from './CounterField.stories'; const composedStories = composeStories(stories); describe('CounterField Story Snapshots', () => { it('has tests for all stories', () => { const storyNames = Object.keys(composedStories); const testedStories = new Set(['Default', 'Disabled', 'Error', 'Warning', 'Hint', 'Required', 'WithMinMax']); const untestedStories = storyNames.filter(name => !testedStories.has(name)); expect(untestedStories).toEqual([]); }); it('renders Default story', () => { const Story = composedStories.Default; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); it('renders Disabled story', () => { const Story = composedStories.Disabled; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); it('renders Error story', () => { const Story = composedStories.Error; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Value must be at least 1
`); }); it('renders Warning story', () => { const Story = composedStories.Warning; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Value is approaching the maximum
`); }); it('renders Hint story', () => { const Story = composedStories.Hint; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Enter the number of items.
`); }); it('renders Required story', () => { const Story = composedStories.Required; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); it('renders WithMinMax story', () => { const Story = composedStories.WithMinMax; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); });