mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: export empty list (#3103)
This commit is contained in:
parent
4ec8d3cb33
commit
5f7c1d8525
@ -105,9 +105,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
|||||||
|
|
||||||
async getAllByNames(names: string[]): Promise<FeatureToggle[]> {
|
async getAllByNames(names: string[]): Promise<FeatureToggle[]> {
|
||||||
const query = this.db<FeaturesTable>(TABLE).orderBy('name', 'asc');
|
const query = this.db<FeaturesTable>(TABLE).orderBy('name', 'asc');
|
||||||
if (names.length > 0) {
|
query.whereIn('name', names);
|
||||||
query.whereIn('name', names);
|
|
||||||
}
|
|
||||||
const rows = await query;
|
const rows = await query;
|
||||||
return rows.map(this.rowToFeature);
|
return rows.map(this.rowToFeature);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ test('should export tags', async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('returns all features, when no feature was defined', async () => {
|
test('returns no features, when no feature was requested', async () => {
|
||||||
await createProject('default', 'default');
|
await createProject('default', 'default');
|
||||||
await createToggle({
|
await createToggle({
|
||||||
name: 'first_feature',
|
name: 'first_feature',
|
||||||
@ -309,5 +309,5 @@ test('returns all features, when no feature was defined', async () => {
|
|||||||
.set('Content-Type', 'application/json')
|
.set('Content-Type', 'application/json')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body.features).toHaveLength(2);
|
expect(body.features).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user