Allow RemoteConfig to be lazily initialized.

This commit is contained in:
Greyson Parrelli
2024-07-09 16:52:00 -04:00
parent 04e75c18dd
commit 91eeda6c6e
3 changed files with 43 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.util
import org.junit.Before
import org.junit.Test
import kotlin.reflect.KProperty1
import kotlin.reflect.KVisibility
@@ -10,6 +11,11 @@ import kotlin.reflect.full.memberProperties
*/
class RemoteConfig_StaticValuesTest {
@Before
fun setup() {
RemoteConfig.initialized = true
}
/**
* This test cycles the REMOTE_VALUES through a bunch of different inputs, then looks at all of the public getters and checks to see if they return different
* values when the inputs change. If they don't, then it's likely that the getter is returning a static value, which was likely introduced during testing
@@ -34,6 +40,7 @@ class RemoteConfig_StaticValuesTest {
val configKeys = RemoteConfig.configsByKey.keys
val ignoreList = setOf(
"initialized",
"REMOTE_VALUES",
"configsByKey",
"debugMemoryValues",