Fix remote config for configs with unspecified on-off values
This commit is contained in:
parent
e98bb0750c
commit
c09dc17867
3 changed files with 15 additions and 2 deletions
|
@ -131,7 +131,7 @@ export const _refreshRemoteConfig = async (
|
|||
const oldConfig = config;
|
||||
config = Array.from(newConfigValues.entries()).reduce(
|
||||
(acc, [name, value]) => {
|
||||
const enabled = value !== undefined;
|
||||
const enabled = value !== undefined && value !== 'false';
|
||||
const previouslyEnabled: boolean = get(
|
||||
oldConfig,
|
||||
[name, 'enabled'],
|
||||
|
|
|
@ -139,6 +139,20 @@ describe('RemoteConfig', () => {
|
|||
assert.equal(isEnabled('desktop.internalUser'), true);
|
||||
});
|
||||
|
||||
it('is true for true string flag', async () => {
|
||||
await updateRemoteConfig([
|
||||
{ name: 'desktop.internalUser', value: 'true' },
|
||||
]);
|
||||
assert.equal(isEnabled('desktop.internalUser'), true);
|
||||
});
|
||||
|
||||
it('is false for false string flag', async () => {
|
||||
await updateRemoteConfig([
|
||||
{ name: 'desktop.internalUser', value: 'false' },
|
||||
]);
|
||||
assert.equal(isEnabled('desktop.internalUser'), false);
|
||||
});
|
||||
|
||||
it('reflects the value of an unknown flag in the config', async () => {
|
||||
assert.equal(
|
||||
isEnabled('desktop.unknownFlagName' as ConfigKeyType),
|
||||
|
|
|
@ -700,7 +700,6 @@ const CHAT_CALLS = {
|
|||
batchIdentityCheck: 'v1/profile/identity_check/batch',
|
||||
boostReceiptCredentials: 'v1/subscription/boost/receipt_credentials',
|
||||
challenge: 'v1/challenge',
|
||||
config: 'v1/config',
|
||||
configV2: 'v2/config',
|
||||
createBoost: 'v1/subscription/boost/create',
|
||||
deliveryCert: 'v1/certificate/delivery',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue