mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-01 02:46:21 +00:00
Do not inject components into other components
This commit is contained in:
@@ -2,6 +2,7 @@ import { screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
import { Home } from '../../src/common/Home';
|
||||
import { ContainerProvider } from '../../src/container/context';
|
||||
import type { ServersMap, ServerWithId } from '../../src/servers/data';
|
||||
import { checkAccessibility } from '../__helpers__/accessibility';
|
||||
import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
@@ -9,7 +10,9 @@ import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
describe('<Home />', () => {
|
||||
const setUp = (servers: ServersMap = {}) => renderWithStore(
|
||||
<MemoryRouter>
|
||||
<Home />
|
||||
<ContainerProvider value={fromPartial({ buildShlinkApiClient: vi.fn() })}>
|
||||
<Home />
|
||||
</ContainerProvider>
|
||||
</MemoryRouter>,
|
||||
{
|
||||
initialState: { servers },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
import { ShlinkWebComponentContainerFactory } from '../../src/common/ShlinkWebComponentContainer';
|
||||
import { ShlinkWebComponentContainer } from '../../src/common/ShlinkWebComponentContainer';
|
||||
import { ContainerProvider } from '../../src/container/context';
|
||||
import type { NonReachableServer, NotFoundServer, SelectedServer } from '../../src/servers/data';
|
||||
import { checkAccessibility } from '../__helpers__/accessibility';
|
||||
@@ -14,13 +14,12 @@ vi.mock('@shlinkio/shlink-web-component', () => ({
|
||||
}));
|
||||
|
||||
describe('<ShlinkWebComponentContainer />', () => {
|
||||
const ShlinkWebComponentContainer = ShlinkWebComponentContainerFactory(fromPartial({
|
||||
buildShlinkApiClient: vi.fn().mockReturnValue(fromPartial({})),
|
||||
TagColorsStorage: fromPartial({}),
|
||||
}));
|
||||
const setUp = (selectedServer: SelectedServer) => renderWithStore(
|
||||
<MemoryRouter>
|
||||
<ContainerProvider value={fromPartial({ buildShlinkApiClient: vi.fn() })}>
|
||||
<ContainerProvider value={fromPartial({
|
||||
buildShlinkApiClient: vi.fn(),
|
||||
TagColorsStorage: fromPartial({}),
|
||||
})}>
|
||||
<ShlinkWebComponentContainer />
|
||||
</ContainerProvider>
|
||||
</MemoryRouter>,
|
||||
|
||||
Reference in New Issue
Block a user