mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: stop changing null to empty string when reading empty title (#8878)
This commit is contained in:
parent
6e9b65b09c
commit
61cb218d4d
@ -858,7 +858,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
|
|||||||
segments: [],
|
segments: [],
|
||||||
sortOrder: r.sort_order,
|
sortOrder: r.sort_order,
|
||||||
id: r.strategy_id,
|
id: r.strategy_id,
|
||||||
title: r.strategy_title || '',
|
title: r.strategy_title,
|
||||||
disabled: r.strategy_disabled || false,
|
disabled: r.strategy_disabled || false,
|
||||||
};
|
};
|
||||||
if (!includeId) {
|
if (!includeId) {
|
||||||
|
@ -444,6 +444,33 @@ test('Cloning a feature flag also clones segments correctly', async () => {
|
|||||||
).toHaveLength(1);
|
).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Should not convert null title to empty string', async () => {
|
||||||
|
const featureName = 'FeatureNoTitle';
|
||||||
|
await service.createFeatureToggle(
|
||||||
|
'default',
|
||||||
|
{
|
||||||
|
name: featureName,
|
||||||
|
},
|
||||||
|
TEST_AUDIT_USER,
|
||||||
|
);
|
||||||
|
const config: Omit<FeatureStrategySchema, 'id'> = {
|
||||||
|
name: 'default',
|
||||||
|
constraints: [],
|
||||||
|
parameters: {},
|
||||||
|
};
|
||||||
|
await service.createStrategy(
|
||||||
|
config,
|
||||||
|
{ projectId: 'default', featureName, environment: DEFAULT_ENV },
|
||||||
|
TEST_AUDIT_USER,
|
||||||
|
);
|
||||||
|
|
||||||
|
const feature = await service.getFeature({
|
||||||
|
featureName: featureName,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(feature.environments[0].strategies[0].title).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
test('If change requests are enabled, cannot change variants without going via CR', async () => {
|
test('If change requests are enabled, cannot change variants without going via CR', async () => {
|
||||||
const featureName = 'feature-with-variants-per-env-and-cr';
|
const featureName = 'feature-with-variants-per-env-and-cr';
|
||||||
await service.createFeatureToggle(
|
await service.createFeatureToggle(
|
||||||
|
Loading…
Reference in New Issue
Block a user