Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop changing null to empty string when reading empty title #8878

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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