import React from 'react';
import { composeStories } from '@storybook/react-vite';
import { render as testRender } from '../../../vitest/render';
import * as stories from './Tree.stories';
const composedStories = composeStories(stories);
describe('Tree Story Snapshots', () => {
it('has tests for all stories', () => {
const storyNames = Object.keys(composedStories);
const testedStories = new Set([
'Basic',
'DeeplyNested',
'SelectionUncontrolled',
'SelectionControlled',
'SelectionScopeChildren',
'SelectionScopeParents',
'ExpansionUncontrolled',
'ExpansionControlled',
'CustomActions',
'CustomActionsLargeDataset',
'LazyLoadingUncontrolled',
'LazyLoadingSubtree',
'LazyLoadingControlled',
'LazyLoadingWithSelection',
'DragAndDropUncontrolled',
'DragAndDropControlled',
'DragAndDropFlatData',
'DragAndDropFlatDataControlled',
'DragAndDropWithLazyLoading',
'DragAndDropWithLazyLoadingControlled',
]);
const untestedStories = storyNames.filter(name => !testedStories.has(name));
expect(untestedStories).toEqual([]);
});
it('renders Basic story', () => {
const Story = composedStories.Basic;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DeeplyNested story', () => {
const Story = composedStories.DeeplyNested;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders SelectionUncontrolled story', () => {
const Story = composedStories.SelectionUncontrolled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders SelectionControlled story', () => {
const Story = composedStories.SelectionControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders SelectionScopeChildren story', () => {
const Story = composedStories.SelectionScopeChildren;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders SelectionScopeParents story', () => {
const Story = composedStories.SelectionScopeParents;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders ExpansionUncontrolled story', () => {
const Story = composedStories.ExpansionUncontrolled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
2025
(
Photos from last year
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders ExpansionControlled story', () => {
const Story = composedStories.ExpansionControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Expanded items:
1, 2, 13, 14
Documents
(
All your important documents
)
Weekly Report
(
Summary of weekly activities and progress
)
Presentations
(
Quarterly and annual presentations
)
2025
(
Photos from last year
)
Work Events
(
Company events and gatherings
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders CustomActions story', () => {
const Story = composedStories.CustomActions;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders CustomActionsLargeDataset story', () => {
const Story = composedStories.CustomActionsLargeDataset;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
Folder 1
(
Description for Folder 1
)
Folder 4
(
Description for Folder 4
)
Folder 7
(
Description for Folder 7
)
Folder 10
(
Description for Folder 10
)
`);
});
it('renders LazyLoadingUncontrolled story', () => {
const Story = composedStories.LazyLoadingUncontrolled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders LazyLoadingSubtree story', () => {
const Story = composedStories.LazyLoadingSubtree;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders LazyLoadingControlled story', () => {
const Story = composedStories.LazyLoadingControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders LazyLoadingWithSelection story', () => {
const Story = composedStories.LazyLoadingWithSelection;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
`);
});
it('renders DragAndDropUncontrolled story', () => {
const Story = composedStories.DragAndDropUncontrolled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DragAndDropControlled story', () => {
const Story = composedStories.DragAndDropControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Drag operations:
0
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DragAndDropFlatData story', () => {
const Story = composedStories.DragAndDropFlatData;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DragAndDropFlatDataControlled story', () => {
const Story = composedStories.DragAndDropFlatDataControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Drag operations:
0
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DragAndDropWithLazyLoading story', () => {
const Story = composedStories.DragAndDropWithLazyLoading;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
it('renders DragAndDropWithLazyLoadingControlled story', () => {
const Story = composedStories.DragAndDropWithLazyLoadingControlled;
const { container } = testRender();
expect(container).toMatchInlineSnapshot(`
Drag operations:
0
Documents
(
All your important documents
)
Downloads
(
Recently downloaded files
)
`);
});
});