Skip to content

Commit

Permalink
fix: export empty list (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Feb 14, 2023
1 parent 4ec8d3c commit 5f7c1d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/lib/db/feature-toggle-store.ts
Expand Up @@ -105,9 +105,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {

async getAllByNames(names: string[]): Promise<FeatureToggle[]> {
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;
return rows.map(this.rowToFeature);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/api/admin/export-import.e2e.test.ts
Expand Up @@ -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 createToggle({
name: 'first_feature',
Expand All @@ -309,5 +309,5 @@ test('returns all features, when no feature was defined', async () => {
.set('Content-Type', 'application/json')
.expect(200);

expect(body.features).toHaveLength(2);
expect(body.features).toHaveLength(0);
});

0 comments on commit 5f7c1d8

Please sign in to comment.