From 4995056ba0ba966d11b4ab5886c85329e38ca375 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 15 Aug 2024 17:09:15 +0100 Subject: [PATCH] Updating tests. --- packages/backend-core/src/features/index.ts | 4 ++-- packages/backend-core/src/features/tests/features.spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend-core/src/features/index.ts b/packages/backend-core/src/features/index.ts index 9c20c97826..e0bd29b1bc 100644 --- a/packages/backend-core/src/features/index.ts +++ b/packages/backend-core/src/features/index.ts @@ -160,7 +160,7 @@ export class FlagSet, T extends { [key: string]: V }> { } // ignore unknown flags - if (this.isFlagName(feature)) { + if (!this.isFlagName(feature)) { continue } @@ -170,7 +170,7 @@ export class FlagSet, T extends { [key: string]: V }> { // @ts-expect-error - TS does not like you writing into a generic type, // but we know that it's okay in this case because it's just an object. - flagValues[feature] = value + flagValues[feature as keyof FlagValues] = value tags[`flags.${feature}.source`] = "environment" } } diff --git a/packages/backend-core/src/features/tests/features.spec.ts b/packages/backend-core/src/features/tests/features.spec.ts index 553558ab14..5cd012f7a5 100644 --- a/packages/backend-core/src/features/tests/features.spec.ts +++ b/packages/backend-core/src/features/tests/features.spec.ts @@ -67,9 +67,9 @@ describe("feature flags", () => { expected: flags.defaults(), }, { - it: "should fail when an environment flag is not recognised", + it: "should ignore unknown feature flags", environmentFlags: "default:TEST_BOOLEAN,default:FOO", - errorMessage: "Feature: FOO is not an allowed option", + expected: { TEST_BOOLEAN: true }, }, { it: "should be able to read boolean flags from PostHog",