From 352ace1e6e895112f89c57fababc77e5fd85b4e5 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 8 Mar 2023 14:56:51 +0100 Subject: [PATCH] fix: exclude favorites from the client api (#3276) --- src/lib/db/feature-toggle-client-store.ts | 2 +- src/test/e2e/api/client/feature.e2e.test.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib/db/feature-toggle-client-store.ts b/src/lib/db/feature-toggle-client-store.ts index 3a70625d89..97c4c8e52c 100644 --- a/src/lib/db/feature-toggle-client-store.ts +++ b/src/lib/db/feature-toggle-client-store.ts @@ -198,7 +198,6 @@ export default class FeatureToggleClientStore feature.impressionData = r.impression_data; feature.enabled = !!r.enabled; feature.name = r.name; - feature.favorite = r.favorite; feature.description = r.description; feature.project = r.project; feature.stale = r.stale; @@ -206,6 +205,7 @@ export default class FeatureToggleClientStore feature.variants = r.variants || []; feature.project = r.project; if (isAdmin) { + feature.favorite = r.favorite; feature.lastSeenAt = r.last_seen_at; feature.createdAt = r.created_at; } diff --git a/src/test/e2e/api/client/feature.e2e.test.ts b/src/test/e2e/api/client/feature.e2e.test.ts index 69dd13290d..5999aed418 100644 --- a/src/test/e2e/api/client/feature.e2e.test.ts +++ b/src/test/e2e/api/client/feature.e2e.test.ts @@ -1,4 +1,7 @@ -import { IUnleashTest, setupApp } from '../../helpers/test-helper'; +import { + IUnleashTest, + setupAppWithCustomConfig, +} from '../../helpers/test-helper'; import dbInit, { ITestDb } from '../../helpers/database-init'; import getLogger from '../../../fixtures/no-logger'; import { DEFAULT_ENV } from '../../../../lib/util/constants'; @@ -8,7 +11,13 @@ let db: ITestDb; beforeAll(async () => { db = await dbInit('feature_api_client', getLogger); - app = await setupApp(db.stores); + app = await setupAppWithCustomConfig(db.stores, { + experimental: { + flags: { + strictSchemaValidation: true, + }, + }, + }); await app.services.featureToggleServiceV2.createFeatureToggle( 'default', {