Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display strategy title and type (#3908)
- Loading branch information
Showing
2 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { render } from 'utils/testRenderer'; | ||
import { StrategyItemContainer } from './StrategyItemContainer'; | ||
import { IFeatureStrategy } from 'interfaces/strategy'; | ||
import { testServerRoute, testServerSetup } from 'utils/testServer'; | ||
import { UIProviderContainer } from '../../providers/UIProvider/UIProviderContainer'; | ||
|
||
const server = testServerSetup(); | ||
testServerRoute(server, '/api/admin/ui-config', { | ||
flags: { strategyImprovements: true }, | ||
}); | ||
|
||
test('should render strategy name, custom title and description', async () => { | ||
const strategy: IFeatureStrategy = { | ||
id: 'irrelevant', | ||
name: 'strategy name', | ||
title: 'custom title', | ||
constraints: [], | ||
parameters: {}, | ||
}; | ||
|
||
render( | ||
<UIProviderContainer> | ||
<StrategyItemContainer | ||
strategy={strategy} | ||
description={'description'} | ||
/> | ||
</UIProviderContainer> | ||
); | ||
|
||
expect(screen.getByText('strategy name')).toBeInTheDocument(); | ||
expect(screen.getByText('description')).toBeInTheDocument(); | ||
await screen.findByText('custom title'); // behind async flag | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters