1
0
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:
Mateusz Kwasniewski 2023-02-14 13:13:58 +01:00 committed by GitHub
parent 4ec8d3cb33
commit 5f7c1d8525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -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);
}

View File

@ -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',
@ -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);
});