Ps/fix dev flags not defined (#6683)
* Handle devFlags not defined * Default dev flags to false
This commit is contained in:
parent
950e327477
commit
c798c92c84
|
@ -13,5 +13,6 @@
|
|||
"secretsManager": true,
|
||||
"showPasswordless": true,
|
||||
"enableCipherKeyEncryption": false
|
||||
}
|
||||
},
|
||||
"devFlags": {}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,13 @@ describe("devFlagEnabled", () => {
|
|||
process.env.ENV = "development";
|
||||
});
|
||||
|
||||
it("returns true by default", () => {
|
||||
expect(devFlagEnabled<any>("nonExistentFlag")).toBe(true);
|
||||
it("returns false by default", () => {
|
||||
expect(devFlagEnabled<any>("nonExistentFlag")).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false if devFlags is not defined", () => {
|
||||
delete process.env.DEV_FLAGS;
|
||||
expect(devFlagEnabled<any>("nonExistentFlag")).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true if enabled", () => {
|
||||
|
|
|
@ -45,7 +45,7 @@ export function devFlagEnabled<DevFlags extends SharedDevFlags>(flag: keyof DevF
|
|||
}
|
||||
|
||||
const devFlags = getFlags<DevFlags>(process.env.DEV_FLAGS);
|
||||
return devFlags[flag] == null || !!devFlags[flag];
|
||||
return devFlags?.[flag] == null ? false : !!devFlags[flag];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue