import React from 'react'; import { composeStories } from '@storybook/react-vite'; import { render as testRender } from '../../../vitest/render'; import * as stories from './Field.stories'; const composedStories = composeStories(stories); describe('Field Story Snapshots', () => { it('has tests for all stories', () => { const storyNames = Object.keys(composedStories); const testedStories = new Set([ 'Default', 'Required', 'WithHint', 'WithWarning', 'WithError', 'Disabled', 'ReadOnly', 'WithTooltip', 'FullWidth', 'Justified', ]); 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 Required story', () => { const Story = composedStories.Required; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
We will never share your email.
`); }); it('renders WithHint story', () => { const Story = composedStories.WithHint; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Must be at least 8 characters.
`); }); it('renders WithWarning story', () => { const Story = composedStories.WithWarning; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
This username is already taken by an inactive account.
`); }); it('renders WithError story', () => { const Story = composedStories.WithError; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Please enter a valid email address.
`); }); it('renders Disabled story', () => { const Story = composedStories.Disabled; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); it('renders ReadOnly story', () => { const Story = composedStories.ReadOnly; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
This value cannot be changed.
`); }); it('renders WithTooltip story', () => { const Story = composedStories.WithTooltip; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
`); }); it('renders FullWidth story', () => { const Story = composedStories.FullWidth; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Briefly describe the item.
`); }); it('renders Justified story', () => { const Story = composedStories.Justified; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Briefly describe the item.
`); }); });