1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-09 00:18:26 +01:00

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.
This commit is contained in:
Thomas Heartman 2025-02-28 10:45:29 +01:00 committed by GitHub
parent 0a0d6e9e2a
commit 97fd1c0fec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(
<LegacyStrategyItemContainer
strategy={strategy}
description={'description'}
/>,
);
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 = {