Updating tests.

This commit is contained in:
mike12345567 2024-08-15 17:09:15 +01:00
parent 21cc83daf4
commit 4995056ba0
2 changed files with 4 additions and 4 deletions

View File

@ -160,7 +160,7 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
}
// ignore unknown flags
if (this.isFlagName(feature)) {
if (!this.isFlagName(feature)) {
continue
}
@ -170,7 +170,7 @@ export class FlagSet<V extends Flag<any>, 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"
}
}

View File

@ -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",