mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-01 19:06:23 +00:00
Explicitly wrap in ContainerProvider when calling renderWithStore
This commit is contained in:
@@ -2,7 +2,6 @@ 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';
|
||||
@@ -10,9 +9,7 @@ import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
describe('<Home />', () => {
|
||||
const setUp = (servers: ServersMap = {}) => renderWithStore(
|
||||
<MemoryRouter>
|
||||
<ContainerProvider value={fromPartial({ buildShlinkApiClient: vi.fn() })}>
|
||||
<Home />
|
||||
</ContainerProvider>
|
||||
<Home />
|
||||
</MemoryRouter>,
|
||||
{
|
||||
initialState: { servers },
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { Router } from 'react-router';
|
||||
import { MainHeader } from '../../src/common/MainHeader';
|
||||
import { ContainerProvider } from '../../src/container/context';
|
||||
import { checkAccessibility } from '../__helpers__/accessibility';
|
||||
import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
|
||||
@@ -14,9 +12,7 @@ describe('<MainHeader />', () => {
|
||||
|
||||
return renderWithStore(
|
||||
<Router location={history.location} navigator={history}>
|
||||
<ContainerProvider value={fromPartial({ buildShlinkApiClient: vi.fn() })}>
|
||||
<MainHeader />
|
||||
</ContainerProvider>
|
||||
<MainHeader />
|
||||
</Router>,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer';
|
||||
import { ContainerProvider } from '../../src/container/context';
|
||||
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
|
||||
import { checkAccessibility } from '../__helpers__/accessibility';
|
||||
import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
|
||||
describe('<ShlinkVersionsContainer />', () => {
|
||||
const setUp = (selectedServer: SelectedServer = null) => renderWithStore(
|
||||
<ContainerProvider value={fromPartial({ buildShlinkApiClient: vi.fn() })}>
|
||||
<ShlinkVersionsContainer />
|
||||
</ContainerProvider>,
|
||||
{
|
||||
initialState: { selectedServer },
|
||||
},
|
||||
);
|
||||
const setUp = (selectedServer: SelectedServer = null) => renderWithStore(<ShlinkVersionsContainer />, {
|
||||
initialState: { selectedServer },
|
||||
});
|
||||
|
||||
it.each([
|
||||
[null],
|
||||
|
||||
@@ -2,7 +2,6 @@ import { screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
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';
|
||||
import { renderWithStore } from '../__helpers__/setUpTest';
|
||||
@@ -16,12 +15,7 @@ vi.mock('@shlinkio/shlink-web-component', () => ({
|
||||
describe('<ShlinkWebComponentContainer />', () => {
|
||||
const setUp = (selectedServer: SelectedServer) => renderWithStore(
|
||||
<MemoryRouter>
|
||||
<ContainerProvider value={fromPartial({
|
||||
buildShlinkApiClient: vi.fn(),
|
||||
TagColorsStorage: fromPartial({}),
|
||||
})}>
|
||||
<ShlinkWebComponentContainer />
|
||||
</ContainerProvider>
|
||||
<ShlinkWebComponentContainer TagColorsStorage={fromPartial({})} />
|
||||
</MemoryRouter>,
|
||||
{
|
||||
initialState: { selectedServer, servers: {}, settings: {} },
|
||||
|
||||
Reference in New Issue
Block a user