Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/cr should activate disabled lag free (#3826)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> - Adds change request option to activate disabled strategies UI - Fixes Disable strategy bug (onSuggestDisable) ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
- Loading branch information
1 parent
6b21a8b
commit 8aadbc8
Showing
13 changed files
with
312 additions
and
259 deletions.
There are no files selected for viewing
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
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
55 changes: 55 additions & 0 deletions
55
...yItem/MenuStrategyRemove/DisableEnableStrategyDialog/DisableEnableStrategyDialog.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,55 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { render } from 'utils/testRenderer'; | ||
import { testServerRoute, testServerSetup } from 'utils/testServer'; | ||
import { DisableEnableStrategyDialog } from './DisableEnableStrategyDialog'; | ||
|
||
const server = testServerSetup(); | ||
|
||
const defaultProps = { | ||
isOpen: true, | ||
onClose: () => {}, | ||
onConfirm: () => {}, | ||
projectId: 'project1', | ||
featureId: 'feature1', | ||
environmentId: 'env1', | ||
strategy: { | ||
id: 'some-id', | ||
name: 'flexibleRollout', | ||
constraints: [], | ||
parameters: { | ||
rollout: '50%', | ||
stickiness: 'default', | ||
}, | ||
}, | ||
}; | ||
|
||
test('should render disable dialog in regular mode', async () => { | ||
testServerRoute(server, '/api/admin/ui-config', {}); | ||
testServerRoute(server, '/api/admin/projects/project1', {}); | ||
|
||
render(<DisableEnableStrategyDialog {...defaultProps} />); | ||
|
||
expect( | ||
screen.queryByText('Change requests are enabled for this environment.') | ||
).not.toBeInTheDocument(); | ||
expect( | ||
screen.getByText('Are you sure you want to disable this strategy?') | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
test('should render enable dialog in regular mode', async () => { | ||
testServerRoute(server, '/api/admin/ui-config', {}); | ||
testServerRoute(server, '/api/admin/projects/project1', {}); | ||
|
||
const props = { | ||
...defaultProps, | ||
strategy: { ...defaultProps.strategy, disabled: true }, | ||
}; | ||
|
||
render(<DisableEnableStrategyDialog {...props} />); | ||
|
||
expect( | ||
screen.queryByText('Change requests are enabled for this environment.') | ||
).not.toBeInTheDocument(); | ||
expect(screen.getByText('Enable strategy')).toBeInTheDocument(); | ||
}); |
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
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
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
Oops, something went wrong.