Add first accessibility tests

This commit is contained in:
Alejandro Celaya
2023-09-30 10:20:28 +02:00
parent ed83d4e842
commit 6d1d3c021a
17 changed files with 168 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router';
import { Home } from '../../src/common/Home';
import type { ServersMap, ServerWithId } from '../../src/servers/data';
import { checkAccessibility } from '../__helpers__/accessibility';
describe('<Home />', () => {
const setUp = (servers: ServersMap = {}) => render(
@@ -11,6 +12,10 @@ describe('<Home />', () => {
</MemoryRouter>,
);
it('passes a11y checks', () => checkAccessibility(
setUp({ '1a': fromPartial<ServerWithId>({ name: 'foo', id: '1' }) }),
));
it('renders title', () => {
setUp();
expect(screen.getByRole('heading', { name: 'Welcome!' })).toBeInTheDocument();