mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-12 01:17:04 +02:00
feat: sort parent options alphabetically (#5238)
This commit is contained in:
parent
bc66fb649f
commit
cbc89f6a92
@ -77,7 +77,8 @@ export class DependentFeaturesReadModel implements IDependentFeaturesReadModel {
|
||||
.andWhere('features.name', '!=', child)
|
||||
.andWhere('dependent_features.child', null)
|
||||
.andWhere('features.archived_at', null)
|
||||
.select('features.name');
|
||||
.select('features.name')
|
||||
.orderBy('features.name');
|
||||
|
||||
return rows.map((item) => item.name);
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ afterAll(async () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await db.stores.dependentFeaturesStore.deleteAll();
|
||||
await db.stores.featureToggleStore.deleteAll();
|
||||
});
|
||||
|
||||
const addFeatureDependency = async (
|
||||
@ -136,6 +137,20 @@ test('should add and delete feature dependencies', async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('should sort parent options alphabetically', async () => {
|
||||
const parent1 = `a${uuidv4()}`;
|
||||
const parent2 = `c${uuidv4()}`;
|
||||
const parent3 = `b${uuidv4()}`;
|
||||
const child = uuidv4();
|
||||
await app.createFeature(parent1);
|
||||
await app.createFeature(parent2);
|
||||
await app.createFeature(parent3);
|
||||
await app.createFeature(child);
|
||||
|
||||
const { body: parentOptions } = await getParentOptions(child);
|
||||
expect(parentOptions).toStrictEqual([parent1, parent3, parent2]);
|
||||
});
|
||||
|
||||
test('should not allow to add grandparent', async () => {
|
||||
const grandparent = uuidv4();
|
||||
const parent = uuidv4();
|
||||
|
Loading…
Reference in New Issue
Block a user