1
0
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:
Mateusz Kwasniewski 2024-11-28 12:16:45 +01:00 committed by GitHub
parent 6e9b65b09c
commit 61cb218d4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

View File

@ -858,7 +858,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
segments: [],
sortOrder: r.sort_order,
id: r.strategy_id,
title: r.strategy_title || '',
title: r.strategy_title,
disabled: r.strategy_disabled || false,
};
if (!includeId) {

View File

@ -444,6 +444,33 @@ test('Cloning a feature flag also clones segments correctly', async () => {
).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 () => {
const featureName = 'feature-with-variants-per-env-and-cr';
await service.createFeatureToggle(