mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
fix: should be allowed to change strategy (#10441)
## About the changes Previous PR: https://github.com/Unleash/unleash/pull/10439 introduced a bug not allowing to update the strategy name This PR modifies a test to also validate the change of strategy and fixes the problem
This commit is contained in:
parent
0d0257bbdc
commit
2f1ca50bc4
@ -698,8 +698,8 @@ export class FeatureToggleService {
|
|||||||
strategyConfig: Unsaved<IStrategyConfig>,
|
strategyConfig: Unsaved<IStrategyConfig>,
|
||||||
existing?: IFeatureStrategy,
|
existing?: IFeatureStrategy,
|
||||||
): Promise<
|
): Promise<
|
||||||
{ strategyName: string } & Pick<
|
{ name: string } & Pick<
|
||||||
Partial<IFeatureStrategy>,
|
Partial<IStrategyConfig>,
|
||||||
| 'title'
|
| 'title'
|
||||||
| 'disabled'
|
| 'disabled'
|
||||||
| 'variants'
|
| 'variants'
|
||||||
@ -731,7 +731,7 @@ export class FeatureToggleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
strategyName: name,
|
name,
|
||||||
title,
|
title,
|
||||||
disabled,
|
disabled,
|
||||||
sortOrder,
|
sortOrder,
|
||||||
@ -770,6 +770,7 @@ export class FeatureToggleService {
|
|||||||
const newFeatureStrategy =
|
const newFeatureStrategy =
|
||||||
await this.featureStrategiesStore.createStrategyFeatureEnv({
|
await this.featureStrategiesStore.createStrategyFeatureEnv({
|
||||||
...standardizedConfig,
|
...standardizedConfig,
|
||||||
|
strategyName: standardizedConfig.name,
|
||||||
constraints: standardizedConfig.constraints || [],
|
constraints: standardizedConfig.constraints || [],
|
||||||
variants: standardizedConfig.variants || [],
|
variants: standardizedConfig.variants || [],
|
||||||
parameters: standardizedConfig.parameters || {},
|
parameters: standardizedConfig.parameters || {},
|
||||||
|
|||||||
@ -136,13 +136,18 @@ test('Should be able to update existing strategy configuration', async () => {
|
|||||||
expect(createdConfig.name).toEqual('default');
|
expect(createdConfig.name).toEqual('default');
|
||||||
const updatedConfig = await service.updateStrategy(
|
const updatedConfig = await service.updateStrategy(
|
||||||
createdConfig.id,
|
createdConfig.id,
|
||||||
{ parameters: { b2b: 'true' } },
|
{ name: 'flexibleRollout', parameters: { b2b: 'true' } },
|
||||||
{ projectId, featureName, environment: DEFAULT_ENV },
|
{ projectId, featureName, environment: DEFAULT_ENV },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
expect(createdConfig.id).toEqual(updatedConfig.id);
|
expect(createdConfig.id).toEqual(updatedConfig.id);
|
||||||
|
expect(updatedConfig.name).toEqual('flexibleRollout');
|
||||||
expect(updatedConfig.parameters).toEqual({
|
expect(updatedConfig.parameters).toEqual({
|
||||||
b2b: 'true',
|
b2b: 'true',
|
||||||
|
// flexible rollout default parameters
|
||||||
|
rollout: '100',
|
||||||
|
groupId: featureName,
|
||||||
|
stickiness: 'default',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user