import { mockAppRoot } from '@rocket.chat/mock-providers'; import { composeStories } from '@storybook/react'; import { render } from '@testing-library/react'; import { axe } from 'jest-axe'; import * as stories from './UsersTable.stories'; const testCases = Object.values(composeStories(stories)).map((Story) => [Story.storyName || 'Story', Story]); test.each(testCases)(`renders %s without crashing`, async (_storyname, Story) => { const { baseElement } = render(, { wrapper: mockAppRoot().build() }); expect(baseElement).toMatchSnapshot(); }); test.each(testCases)('%s should have no a11y violations', async (_storyname, Story) => { const { container } = render(, { wrapper: mockAppRoot().build() }); // TODO: Needed to skip `button-name` because fuselageā€˜s `Pagination` buttons are missing names const results = await axe(container, { rules: { 'button-name': { enabled: false } } }); expect(results).toHaveNoViolations(); });