1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

feat: Enforce one dependency (#4835)

This commit is contained in:
Mateusz Kwasniewski 2023-09-26 14:31:13 +02:00 committed by GitHub
parent e030b67a19
commit 76a2ec53f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -23,6 +23,11 @@ export class DependentFeaturesStore implements IDependentFeaturesStore {
featureDependency.variants, featureDependency.variants,
); );
} }
// TODO: remove when we support multiple parents
await this.db('dependent_features')
.where('child', featureDependency.child)
.del();
await this.db('dependent_features') await this.db('dependent_features')
.insert(serializableFeatureDependency) .insert(serializableFeatureDependency)
.onConflict(['parent', 'child']) .onConflict(['parent', 'child'])

View File

@ -60,11 +60,6 @@ beforeAll(async () => {
'featureY', 'featureY',
{ feature: 'featureX', variants: ['featureXVariant'] }, { feature: 'featureX', variants: ['featureXVariant'] },
); );
// depend on parent being disabled
await app.services.dependentFeaturesService.upsertFeatureDependency(
'featureY',
{ feature: 'featureZ', enabled: false },
);
await app.services.featureToggleServiceV2.archiveToggle( await app.services.featureToggleServiceV2.archiveToggle(
'featureArchivedX', 'featureArchivedX',
@ -154,10 +149,6 @@ test('returns dependencies', async () => {
enabled: true, enabled: true,
variants: ['featureXVariant'], variants: ['featureXVariant'],
}, },
{
feature: 'featureZ',
enabled: false,
},
], ],
}); });
expect(res.body.features[1].dependencies).toBe(undefined); expect(res.body.features[1].dependencies).toBe(undefined);