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

This commit is contained in:
Alejandro Celaya
2026-08-16 20:55:48 +02:00
parent 7b9f084f9c
commit c5c994a603
18 changed files with 113 additions and 441 deletions

View File

@@ -1,4 +1,3 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router';
import type { NonReachableServer, NotFoundServer, SelectedServer } from '../../../src/servers/data';
@@ -46,9 +45,9 @@ describe('<ServerError />', () => {
},
],
])('renders expected information based on provided server type', async (selectedServer, { found, notFound }) => {
setUp(selectedServer);
const screen = await setUp(selectedServer);
await Promise.all(found.map((text) => expect.element(screen.getByText(text)).toBeInTheDocument()));
await Promise.all(notFound.map((text) => expect.element(screen.queryByText(text)).not.toBeInTheDocument()));
await Promise.all(notFound.map((text) => expect.element(screen.getByText(text)).not.toBeInTheDocument()));
});
});