diff --git a/src/lib/features/feature-toggle/feature-toggle-strategies-store.ts b/src/lib/features/feature-toggle/feature-toggle-strategies-store.ts index 05343d1ff0e9..9d58a1ec1dde 100644 --- a/src/lib/features/feature-toggle/feature-toggle-strategies-store.ts +++ b/src/lib/features/feature-toggle/feature-toggle-strategies-store.ts @@ -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) { diff --git a/src/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.ts b/src/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.ts index fb93c96dab4b..168d3736616c 100644 --- a/src/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.ts +++ b/src/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.ts @@ -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 = { + 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(