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:
parent
e030b67a19
commit
76a2ec53f1
@ -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'])
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user