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,4 +1,4 @@
import { fireEvent, waitFor } from '@testing-library/react';
import { fireEvent } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { createMemoryHistory } from 'history';
import { Router } from 'react-router';
@@ -97,7 +97,7 @@ describe('<CreateServer />', () => {
fireEvent.submit(page.getByTestId('server-form').element());
await waitFor(() => expect(page.getByRole('dialog')).toBeInTheDocument());
await expect.element(page.getByRole('dialog')).toBeInTheDocument();
await user.click(page.getByRole('button', { name: 'Discard' }));
expect(history.location.pathname).toEqual('/foo'); // Goes back to first route from history's initialEntries