Replace direct rendering with react testing library by vitest-browser-react

This commit is contained in:
Alejandro Celaya
2026-08-16 19:59:44 +02:00
parent 585d7c6f63
commit 260bdb260c
13 changed files with 86 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
import { ScrollToTop } from '../../src/common/ScrollToTop';
import { checkAccessibility } from '../__helpers__/accessibility';
import { render } from '../__helpers__/setUpTest.tsx';
describe('<ScrollToTop />', () => {
const setUp = (children = 'Foo') =>
@@ -14,7 +14,7 @@ describe('<ScrollToTop />', () => {
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([['Foobar'], ['Barfoo'], ['Something']])('just renders children', async (children) => {
setUp(children);
const screen = await setUp(children);
await expect.element(screen.getByText(children)).toBeInTheDocument();
});
});