-
- {JSON.stringify(props.projects)}
-
-
- {JSON.stringify(props.environments)}
-
-
{JSON.stringify(props.context)}
+
(
+
+
{JSON.stringify(props.projects)}
+
+ {JSON.stringify(props.environments)}
- )}
- />
-
+
{JSON.stringify(props.context)}
+
+ )}
+ />
);
const testEvaluateComponent = (
-
- (
-
- )}
- />
-
+ (
+
+ )}
+ />
);
afterEach(() => {
diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx
index 90ca2b564d..ddd4845993 100644
--- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx
+++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx
@@ -1,109 +1,104 @@
import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
-import { UIProviderContainer } from 'component/providers/UIProvider/UIProviderContainer';
import { AdvancedPlaygroundResultsTable } from './AdvancedPlaygroundResultsTable';
test('should render advanced playground table', async () => {
render(
-
-
- ,
+ },
+ ]}
+ input={{
+ environments: ['development', 'production'],
+ projects: '*',
+ context: {
+ appName: 'MyApp',
+ },
+ }}
+ />,
);
expect(screen.getByText('Infinite')).toBeInTheDocument();
diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx
index 7e90c4de88..3d91e2fd91 100644
--- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx
+++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx
@@ -1,7 +1,6 @@
import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { PlaygroundEnvironmentDiffTable } from './PlaygroundEnvironmentDiffTable';
-import { UIProviderContainer } from '../../../providers/UIProvider/UIProviderContainer';
const irrelevantDetails = {
strategies: {
@@ -23,38 +22,36 @@ const irrelevantDetails = {
test('should render environment diff table', async () => {
render(
-
-
- ,
+ ...irrelevantDetails,
+ },
+ ],
+ }}
+ />,
);
expect(screen.getByText('web')).toBeInTheDocument();
diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx
index 22e0c992d3..d9520fb8db 100644
--- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx
+++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx
@@ -1,41 +1,38 @@
import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { PlaygroundEnvironmentTable } from './PlaygroundEnvironmentTable';
-import { UIProviderContainer } from '../../../providers/UIProvider/UIProviderContainer';
test('should render environment table', async () => {
render(
-
-
- ,
+ environment: 'dev',
+ context: {
+ channel: 'web',
+ client: 'clientA',
+ appName: 'myapp',
+ },
+ },
+ ]}
+ />,
);
expect(screen.getByText('web')).toBeInTheDocument();
diff --git a/frontend/src/component/segments/SegmentTable/SegmentTable.test.tsx b/frontend/src/component/segments/SegmentTable/SegmentTable.test.tsx
index 81209b3572..445c2c63a2 100644
--- a/frontend/src/component/segments/SegmentTable/SegmentTable.test.tsx
+++ b/frontend/src/component/segments/SegmentTable/SegmentTable.test.tsx
@@ -1,8 +1,7 @@
-import { render } from '../../../utils/testRenderer';
+import { render } from 'utils/testRenderer';
import { screen } from '@testing-library/react';
import { SegmentTable } from './SegmentTable';
-import { testServerRoute, testServerSetup } from '../../../utils/testServer';
-import { UIProviderContainer } from '../../providers/UIProvider/UIProviderContainer';
+import { testServerRoute, testServerSetup } from 'utils/testServer';
const server = testServerSetup();
@@ -31,11 +30,7 @@ const setupRoutes = () => {
test('should show the count of projects and features used in', async () => {
setupRoutes();
- render(
-
-
- ,
- );
+ render();
await screen.findByText('2 feature toggles');
await screen.findByText('3 projects');
diff --git a/frontend/src/component/user/Profile/PasswordTab/PasswordTab.test.tsx b/frontend/src/component/user/Profile/PasswordTab/PasswordTab.test.tsx
index 0645f3b26a..7b5bf1a2ce 100644
--- a/frontend/src/component/user/Profile/PasswordTab/PasswordTab.test.tsx
+++ b/frontend/src/component/user/Profile/PasswordTab/PasswordTab.test.tsx
@@ -3,7 +3,6 @@ import { render } from 'utils/testRenderer';
import { testServerRoute, testServerSetup } from 'utils/testServer';
import { PasswordTab } from './PasswordTab';
import userEvent from '@testing-library/user-event';
-import { UIProviderContainer } from '../../../providers/UIProvider/UIProviderContainer';
const server = testServerSetup();
testServerRoute(server, '/api/admin/ui-config', {});
@@ -16,11 +15,7 @@ testServerRoute(server, '/auth/reset/validate-password', {}, 'post');
test('should render authorization error on missing old password', async () => {
const user = userEvent.setup();
- render(
-
-
- ,
- );
+ render();
await screen.findByText('Change password');
const passwordInput = await screen.findByLabelText('Password');
diff --git a/frontend/src/utils/testRenderer.tsx b/frontend/src/utils/testRenderer.tsx
index 5ad3c7384f..c9bb09a98e 100644
--- a/frontend/src/utils/testRenderer.tsx
+++ b/frontend/src/utils/testRenderer.tsx
@@ -6,6 +6,7 @@ import { ThemeProvider } from 'themes/ThemeProvider';
import { IPermission } from 'interfaces/user';
import { AnnouncerProvider } from 'component/common/Announcer/AnnouncerProvider/AnnouncerProvider';
import { AccessProviderMock } from 'component/providers/AccessProvider/AccessProviderMock';
+import { UIProviderContainer } from '../component/providers/UIProvider/UIProviderContainer';
export const render = (
ui: JSX.Element,
@@ -21,15 +22,17 @@ export const render = (
window.history.pushState({}, 'Test page', route);
const Wrapper: FC = ({ children }) => (
- new Map() }}>
-
-
-
- {children}
-
-
-
-
+
+ new Map() }}>
+
+
+
+ {children}
+
+
+
+
+
);
return rtlRender(ui, {