Do not inject servers state or actions

This commit is contained in:
Alejandro Celaya
2025-11-14 19:23:48 +01:00
parent ae7aea0e2c
commit a7f2d3224b
38 changed files with 292 additions and 375 deletions

View File

@@ -1,21 +1,16 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { createMemoryHistory } from 'history';
import { Router } from 'react-router';
import { MainHeaderFactory } from '../../src/common/MainHeader';
import { MainHeader } from '../../src/common/MainHeader';
import { checkAccessibility } from '../__helpers__/accessibility';
import { renderWithEvents } from '../__helpers__/setUpTest';
import { renderWithStore } from '../__helpers__/setUpTest';
describe('<MainHeader />', () => {
const MainHeader = MainHeaderFactory(fromPartial({
// Fake this component as a li[role="menuitem"], as it gets rendered inside a ul[role="menu"]
ServersDropdown: () => <li role="menuitem">ServersDropdown</li>,
}));
const setUp = (pathname = '') => {
const history = createMemoryHistory();
history.push(pathname);
return renderWithEvents(
return renderWithStore(
<Router location={history.location} navigator={history}>
<MainHeader />
</Router>,
@@ -26,7 +21,7 @@ describe('<MainHeader />', () => {
it('renders ServersDropdown', () => {
setUp();
expect(screen.getByText('ServersDropdown')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Servers' })).toBeInTheDocument();
});
it.each([