import React from 'react'; import { composeStories } from '@storybook/react-vite'; import { render as testRender } from '../../../../vitest/render'; import * as stories from './RadioField.stories'; const composedStories = composeStories(stories); describe('RadioField Story Snapshots', () => { it('has tests for all stories', () => { const storyNames = Object.keys(composedStories); const testedStories = new Set([ 'Default', 'WithActions', 'HiddenLabel', 'WithHint', 'WithWarning', 'InvalidWithError', 'Horizontal', 'WithImageOptions', 'WithVerticalImageOptions', 'WithImageOptionsGrid', 'WithImageOptionsError', 'WithImageOptionsWarning', ]); 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(`
Choose your plan
`); }); it('renders WithActions story', () => { const Story = composedStories.WithActions; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
City
`); }); it('renders HiddenLabel story', () => { const Story = composedStories.HiddenLabel; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
City
`); }); it('renders WithHint story', () => { const Story = composedStories.WithHint; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Car
Hint: Please select your favorite car
`); }); it('renders WithWarning story', () => { const Story = composedStories.WithWarning; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Animal
Warning: Please check your selection
`); }); it('renders InvalidWithError story', () => { const Story = composedStories.InvalidWithError; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Gender
This field is required
`); }); it('renders Horizontal story', () => { const Story = composedStories.Horizontal; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose your plan
`); }); it('renders WithImageOptions story', () => { const Story = composedStories.WithImageOptions; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose scenery
`); }); it('renders WithVerticalImageOptions story', () => { const Story = composedStories.WithVerticalImageOptions; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose color
`); }); it('renders WithImageOptionsGrid story', () => { const Story = composedStories.WithImageOptionsGrid; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose option
`); }); it('renders WithImageOptionsError story', () => { const Story = composedStories.WithImageOptionsError; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose color
Please select an option
`); }); it('renders WithImageOptionsWarning story', () => { const Story = composedStories.WithImageOptionsWarning; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Choose color
This selection may affect your order
`); }); });