import React from 'react'; import { composeStories } from '@storybook/react-vite'; import { render as testRender } from '../../../vitest/render'; import * as stories from './Image.stories'; const composedStories = composeStories(stories); describe('Image Story Snapshots', () => { it('has tests for all stories', () => { const storyNames = Object.keys(composedStories); const testedStories = new Set([ 'Default', 'Responsive', 'CoverWithCustomRatio', 'Example800x600', 'Portrait600x900', 'Small200x200', 'Square600x600', 'Large2000x1200', 'Widescreen1600x900', 'SizeSmall', 'SizeLarge', 'LoadingError', ]); 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(`
Product image
`); }); it('renders Responsive story', () => { const Story = composedStories.Responsive; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Responsive product image
`); }); it('renders CoverWithCustomRatio story', () => { const Story = composedStories.CoverWithCustomRatio; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Cover product image
`); }); it('renders Example800x600 story', () => { const Story = composedStories.Example800x600; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Example 800x600
`); }); it('renders Portrait600x900 story', () => { const Story = composedStories.Portrait600x900; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Portrait 600x900
`); }); it('renders Small200x200 story', () => { const Story = composedStories.Small200x200; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Small example 200x200
`); }); it('renders Square600x600 story', () => { const Story = composedStories.Square600x600; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Square example600x600
`); }); it('renders Large2000x1200 story', () => { const Story = composedStories.Large2000x1200; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Large example 2000x1200
`); }); it('renders Widescreen1600x900 story', () => { const Story = composedStories.Widescreen1600x900; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Widescreen 1600x900
`); }); it('renders SizeSmall story', () => { const Story = composedStories.SizeSmall; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Small size image
`); }); it('renders SizeLarge story', () => { const Story = composedStories.SizeLarge; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
Large size image
`); }); it('renders LoadingError story', () => { const Story = composedStories.LoadingError; const { container } = testRender(); expect(container).toMatchInlineSnapshot(`
This is an example image
`); }); });