From 97fd1c0fecef553339d42ace20ee59c71b5cbed9 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 28 Feb 2025 10:45:29 +0100 Subject: [PATCH] chore(1-3423): adapt existing tests to new components (#9396) Adds tests for the new version of components that were moved to legacy files in https://github.com/Unleash/unleash/pull/9361 and where there were tests already. --- .../StrategyItemContainer.test.tsx | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx index 9ec65ea4be..902dc10af6 100644 --- a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx @@ -1,7 +1,30 @@ import { screen } from '@testing-library/react'; import { render } from 'utils/testRenderer'; -import { StrategyItemContainer } from './LegacyStrategyItemContainer'; +import { StrategyItemContainer as LegacyStrategyItemContainer } from './LegacyStrategyItemContainer'; import type { IFeatureStrategy } from 'interfaces/strategy'; +import { StrategyItemContainer } from './StrategyItemContainer'; + +// todo: remove this test along with the flag flagOverviewRedesign +test('(deprecated) should render strategy name, custom title and description', async () => { + const strategy: IFeatureStrategy = { + id: 'irrelevant', + name: 'strategy name', + title: 'custom title', + constraints: [], + parameters: {}, + }; + + render( + , + ); + + expect(screen.getByText('strategy name')).toBeInTheDocument(); + expect(screen.getByText('description')).toBeInTheDocument(); + await screen.findByText('custom title'); // behind async flag +}); test('should render strategy name, custom title and description', async () => { const strategy: IFeatureStrategy = {