Skip to content

Commit

Permalink
fix: stop changing null to empty string when reading empty title (#8878)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Nov 28, 2024
1 parent 6e9b65b commit 61cb218
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 61cb218

Please sign in to comment.