mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-24 19:56:00 +00:00
Rename FeatureFlags -> RemoteConfig.
This commit is contained in:
@@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.keyvalue.KeyValueDataSet
|
||||
import org.thoughtcrime.securesms.keyvalue.KeyValueStore
|
||||
import org.thoughtcrime.securesms.keyvalue.MockKeyValuePersistentStorage
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.util.UUID
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@@ -26,7 +26,7 @@ class CrashConfigTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
mockkObject(FeatureFlags)
|
||||
mockkObject(RemoteConfig)
|
||||
|
||||
if (!AppDependencies.isInitialized) {
|
||||
AppDependencies.init(ApplicationProvider.getApplicationContext(), MockApplicationDependencyProvider())
|
||||
@@ -45,31 +45,31 @@ class CrashConfigTest {
|
||||
|
||||
@Test
|
||||
fun `simple name pattern`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "name": "test", "percent": 100 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "name": "test", "percent": 100 } ]"""
|
||||
CrashConfig.computePatterns() assertIs listOf(CrashConfig.CrashPattern(namePattern = "test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `simple message pattern`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "message": "test", "percent": 100 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "message": "test", "percent": 100 } ]"""
|
||||
CrashConfig.computePatterns() assertIs listOf(CrashConfig.CrashPattern(messagePattern = "test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `simple stackTrace pattern`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "stackTrace": "test", "percent": 100 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "stackTrace": "test", "percent": 100 } ]"""
|
||||
CrashConfig.computePatterns() assertIs listOf(CrashConfig.CrashPattern(stackTracePattern = "test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `all fields set`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "name": "test1", "message": "test2", "stackTrace": "test3", "percent": 100 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "name": "test1", "message": "test2", "stackTrace": "test3", "percent": 100 } ]"""
|
||||
CrashConfig.computePatterns() assertIs listOf(CrashConfig.CrashPattern(namePattern = "test1", messagePattern = "test2", stackTracePattern = "test3"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `multiple configs`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns
|
||||
every { RemoteConfig.crashPromptConfig } returns
|
||||
"""
|
||||
[
|
||||
{ "name": "test1", "percent": 100 },
|
||||
@@ -87,7 +87,7 @@ class CrashConfigTest {
|
||||
|
||||
@Test
|
||||
fun `empty fields are considered null`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns
|
||||
every { RemoteConfig.crashPromptConfig } returns
|
||||
"""
|
||||
[
|
||||
{ "name": "", "percent": 100 },
|
||||
@@ -104,31 +104,31 @@ class CrashConfigTest {
|
||||
|
||||
@Test
|
||||
fun `ignore zero percent`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "name": "test", "percent": 0 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "name": "test", "percent": 0 } ]"""
|
||||
CrashConfig.computePatterns() assertIs emptyList()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `not setting percent is the same as zero percent`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "name": "test" } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "name": "test" } ]"""
|
||||
CrashConfig.computePatterns() assertIs emptyList()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ignore configs without a pattern`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns """[ { "percent": 100 } ]"""
|
||||
every { RemoteConfig.crashPromptConfig } returns """[ { "percent": 100 } ]"""
|
||||
CrashConfig.computePatterns() assertIs emptyList()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ignore invalid json`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns "asdf"
|
||||
every { RemoteConfig.crashPromptConfig } returns "asdf"
|
||||
CrashConfig.computePatterns() assertIs emptyList()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ignore empty json`() {
|
||||
every { FeatureFlags.crashPromptConfig } returns ""
|
||||
every { RemoteConfig.crashPromptConfig } returns ""
|
||||
CrashConfig.computePatterns() assertIs emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.dependencies.MockApplicationDependencyProvider
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(manifest = Config.NONE, application = Application::class)
|
||||
@@ -24,7 +24,7 @@ class PaymentsValuesTest {
|
||||
AppDependencies.init(ApplicationProvider.getApplicationContext(), MockApplicationDependencyProvider())
|
||||
}
|
||||
|
||||
mockkObject(FeatureFlags)
|
||||
mockkObject(RemoteConfig)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -48,8 +48,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns false
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns ""
|
||||
every { RemoteConfig.payments } returns false
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns ""
|
||||
|
||||
assertEquals(PaymentsAvailability.DISABLED_REMOTELY, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
@@ -64,8 +64,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns false
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns ""
|
||||
every { RemoteConfig.payments } returns false
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns ""
|
||||
|
||||
assertEquals(PaymentsAvailability.WITHDRAW_ONLY, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
@@ -80,8 +80,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns true
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns ""
|
||||
every { RemoteConfig.payments } returns true
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns ""
|
||||
|
||||
assertEquals(PaymentsAvailability.REGISTRATION_AVAILABLE, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
@@ -96,8 +96,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns true
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns ""
|
||||
every { RemoteConfig.payments } returns true
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns ""
|
||||
|
||||
assertEquals(PaymentsAvailability.WITHDRAW_AND_SEND, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
@@ -112,8 +112,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns true
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns "1"
|
||||
every { RemoteConfig.payments } returns true
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns "1"
|
||||
|
||||
assertEquals(PaymentsAvailability.NOT_IN_REGION, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
@@ -128,8 +128,8 @@ class PaymentsValuesTest {
|
||||
}
|
||||
)
|
||||
|
||||
every { FeatureFlags.payments } returns true
|
||||
every { FeatureFlags.paymentsCountryBlocklist } returns "1"
|
||||
every { RemoteConfig.payments } returns true
|
||||
every { RemoteConfig.paymentsCountryBlocklist } returns "1"
|
||||
|
||||
assertEquals(PaymentsAvailability.WITHDRAW_ONLY, SignalStore.paymentsValues().paymentsAvailability)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -18,22 +18,22 @@ public final class GeographicalRestrictionsTest {
|
||||
public MockitoRule rule = MockitoJUnit.rule();
|
||||
|
||||
@Mock
|
||||
private MockedStatic<FeatureFlags> featureFlagsMockedStatic;
|
||||
private MockedStatic<RemoteConfig> remoteConfigMockedStatic;
|
||||
|
||||
@Test
|
||||
public void e164Allowed_general() {
|
||||
when(FeatureFlags.paymentsCountryBlocklist()).thenReturn("");
|
||||
when(RemoteConfig.paymentsCountryBlocklist()).thenReturn("");
|
||||
assertTrue(GeographicalRestrictions.e164Allowed("+15551234567"));
|
||||
|
||||
when(FeatureFlags.paymentsCountryBlocklist()).thenReturn("1");
|
||||
when(RemoteConfig.paymentsCountryBlocklist()).thenReturn("1");
|
||||
assertFalse(GeographicalRestrictions.e164Allowed("+15551234567"));
|
||||
|
||||
when(FeatureFlags.paymentsCountryBlocklist()).thenReturn("1,44");
|
||||
when(RemoteConfig.paymentsCountryBlocklist()).thenReturn("1,44");
|
||||
assertFalse(GeographicalRestrictions.e164Allowed("+15551234567"));
|
||||
assertFalse(GeographicalRestrictions.e164Allowed("+445551234567"));
|
||||
assertTrue(GeographicalRestrictions.e164Allowed("+525551234567"));
|
||||
|
||||
when(FeatureFlags.paymentsCountryBlocklist()).thenReturn("1 234,44");
|
||||
when(RemoteConfig.paymentsCountryBlocklist()).thenReturn("1 234,44");
|
||||
assertFalse(GeographicalRestrictions.e164Allowed("+12341234567"));
|
||||
assertTrue(GeographicalRestrictions.e164Allowed("+15551234567"));
|
||||
assertTrue(GeographicalRestrictions.e164Allowed("+525551234567"));
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.database.RecipientTable
|
||||
import org.thoughtcrime.securesms.keyvalue.AccountValues
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.testutil.EmptyLogger
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.PNI
|
||||
import org.whispersystems.signalservice.api.storage.SignalContactRecord
|
||||
@@ -38,7 +38,7 @@ class ContactRecordProcessorTest {
|
||||
lateinit var recipientTable: RecipientTable
|
||||
|
||||
@Mock
|
||||
lateinit var featureFlags: MockedStatic<FeatureFlags>
|
||||
lateinit var remoteConfig: MockedStatic<RemoteConfig>
|
||||
|
||||
@Mock
|
||||
lateinit var signalStore: MockedStatic<SignalStore>
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.mockito.junit.MockitoRule;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper.IdDifferenceResult;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
|
||||
import org.whispersystems.signalservice.api.storage.SignalAccountRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalContactRecord;
|
||||
@@ -60,7 +60,7 @@ public final class StorageSyncHelperTest {
|
||||
private MockedStatic<Recipient> recipientMockedStatic;
|
||||
|
||||
@Mock
|
||||
private MockedStatic<FeatureFlags> featureFlagsMockedStatic;
|
||||
private MockedStatic<RemoteConfig> remoteConfigMockedStatic;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.Map;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class LocaleFeatureFlagsTest_getCountryValue {
|
||||
public class LocaleRemoteConfigTest_getCountryValue {
|
||||
|
||||
private final String phoneNumber;
|
||||
private final Map<String, Integer> countryCounts;
|
||||
@@ -66,7 +66,7 @@ public class LocaleFeatureFlagsTest_getCountryValue {
|
||||
Log.initialize(new EmptyLogger());
|
||||
}
|
||||
|
||||
public LocaleFeatureFlagsTest_getCountryValue(@NonNull String phoneNumber,
|
||||
public LocaleRemoteConfigTest_getCountryValue(@NonNull String phoneNumber,
|
||||
@NonNull Map<String, Integer> countryCounts,
|
||||
long output)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ public class LocaleFeatureFlagsTest_getCountryValue {
|
||||
|
||||
@Test
|
||||
public void determineCountEnabled() {
|
||||
assertEquals(output, LocaleFeatureFlags.getCountryValue(countryCounts, phoneNumber, 0));
|
||||
assertEquals(output, LocaleRemoteConfig.getCountryValue(countryCounts, phoneNumber, 0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class LocaleFeatureFlagsTest_parseCountryValues {
|
||||
public class LocaleRemoteConfigTest_parseCountryValues {
|
||||
|
||||
private final String input;
|
||||
private final Map<String, Integer> output;
|
||||
@@ -46,14 +46,14 @@ public class LocaleFeatureFlagsTest_parseCountryValues {
|
||||
});
|
||||
}
|
||||
|
||||
public LocaleFeatureFlagsTest_parseCountryValues(String input, Map<String, Integer> output) {
|
||||
public LocaleRemoteConfigTest_parseCountryValues(String input, Map<String, Integer> output) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseCountryCounts() {
|
||||
assertEquals(output, LocaleFeatureFlags.parseCountryValues(input, 0));
|
||||
assertEquals(output, LocaleRemoteConfig.parseCountryValues(input, 0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import org.junit.runners.Parameterized
|
||||
import org.thoughtcrime.securesms.assertIs
|
||||
|
||||
@RunWith(Parameterized::class)
|
||||
class LocaleFeatureFlags_isEnabled(private val serializedList: String, private val e164: List<String>, private val output: Boolean) {
|
||||
class LocaleRemoteConfig_isEnabled(private val serializedList: String, private val e164: List<String>, private val output: Boolean) {
|
||||
|
||||
@Test
|
||||
fun isLegal() {
|
||||
e164.forEach {
|
||||
LocaleFeatureFlags.isEnabledE164Start(serializedList, it) assertIs output
|
||||
LocaleRemoteConfig.isEnabledE164Start(serializedList, it) assertIs output
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package org.thoughtcrime.securesms.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.thoughtcrime.securesms.BaseUnitTest;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags.ConfigChange;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags.UpdateResult;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.ConfigChange;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.UpdateResult;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -16,14 +16,14 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.thoughtcrime.securesms.testutil.TestHelpers.mapOf;
|
||||
|
||||
public class FeatureFlagsTest extends BaseUnitTest {
|
||||
public class RemoteConfigTest extends BaseUnitTest {
|
||||
|
||||
private static final String A = "A";
|
||||
private static final String B = "B";
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue_ignoreNotInRemoteCapable() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true,
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true,
|
||||
B, true),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
@@ -38,7 +38,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A),
|
||||
@@ -52,7 +52,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue_hotSwap() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A),
|
||||
@@ -66,7 +66,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue_hotSwap_integer() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, 1),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, 1),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A),
|
||||
@@ -80,7 +80,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue_sticky() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A),
|
||||
@@ -94,7 +94,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_newValue_hotSwap_sticky() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A),
|
||||
@@ -108,7 +108,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(A),
|
||||
@@ -122,7 +122,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue_integer() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, 2),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, 2),
|
||||
mapOf(A, 1),
|
||||
mapOf(A, 1),
|
||||
setOf(A),
|
||||
@@ -136,7 +136,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue_hotSwap() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(A),
|
||||
@@ -150,7 +150,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue_hotSwa_integer() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, 2),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, 2),
|
||||
mapOf(A, 1),
|
||||
mapOf(A, 1),
|
||||
setOf(A),
|
||||
@@ -164,7 +164,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue_hotSwap_stickyChange() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(A),
|
||||
@@ -178,7 +178,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceValue_hotSwap_stickyIgnore_memoryAndDisk() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, false),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, false),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -192,7 +192,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -206,7 +206,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_notRemoteCapable() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(),
|
||||
@@ -220,7 +220,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_hotSwap() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -234,7 +234,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_hotSwap_notRemoteCapable() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(),
|
||||
@@ -248,7 +248,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_stickyAlreadyEnabled() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -262,7 +262,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_stickyNotEnabled() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(A),
|
||||
@@ -276,7 +276,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_stickyNotEnabled_notRemoteCapable() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(),
|
||||
@@ -290,7 +290,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_hotSwap_stickyAlreadyEnabled() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -304,7 +304,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_hotSwap_stickyAlreadyEnabled_notRemoteCapable() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(),
|
||||
@@ -318,7 +318,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_hotSwap_stickyNotEnabled() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(),
|
||||
mapOf(A, false),
|
||||
mapOf(A, false),
|
||||
setOf(A),
|
||||
@@ -332,7 +332,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_removeValue_typeMismatch_hotSwap() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, "5"),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, "5"),
|
||||
mapOf(A, true),
|
||||
mapOf(A, true),
|
||||
setOf(A),
|
||||
@@ -346,9 +346,9 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_twoNewValues() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true,
|
||||
B, false),
|
||||
mapOf(),
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true,
|
||||
B, false),
|
||||
mapOf(),
|
||||
mapOf(),
|
||||
setOf(A, B),
|
||||
setOf(),
|
||||
@@ -361,7 +361,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
|
||||
@Test
|
||||
public void updateInternal_replaceOneOfTwoValues() {
|
||||
UpdateResult result = FeatureFlags.updateInternal(mapOf(A, true,
|
||||
UpdateResult result = RemoteConfig.updateInternal(mapOf(A, true,
|
||||
B, false),
|
||||
mapOf(A, true,
|
||||
B, true),
|
||||
@@ -400,7 +400,7 @@ public class FeatureFlagsTest extends BaseUnitTest {
|
||||
put("j", "stacy");
|
||||
}};
|
||||
|
||||
Map<String, ConfigChange> changes = FeatureFlags.computeChanges(oldMap, newMap);
|
||||
Map<String, ConfigChange> changes = RemoteConfig.computeChanges(oldMap, newMap);
|
||||
|
||||
assertFalse(changes.containsKey("a"));
|
||||
assertEquals(new ConfigChange(false, true), changes.get("b"));
|
||||
@@ -8,7 +8,7 @@ import kotlin.reflect.full.memberProperties
|
||||
/**
|
||||
* Ensures we don't release with forced values which is intended for local development only.
|
||||
*/
|
||||
class FeatureFlags_StaticValuesTest {
|
||||
class RemoteConfig_StaticValuesTest {
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -31,7 +31,7 @@ class FeatureFlags_StaticValuesTest {
|
||||
"*"
|
||||
)
|
||||
|
||||
val configKeys = FeatureFlags.configsByKey.keys
|
||||
val configKeys = RemoteConfig.configsByKey.keys
|
||||
|
||||
val ignoreList = setOf(
|
||||
"REMOTE_VALUES",
|
||||
@@ -44,7 +44,7 @@ class FeatureFlags_StaticValuesTest {
|
||||
"PROMPT_FOR_NOTIFICATION_LOGS"
|
||||
)
|
||||
|
||||
val publicVals: List<KProperty1<*, *>> = FeatureFlags::class.memberProperties
|
||||
val publicVals: List<KProperty1<*, *>> = RemoteConfig::class.memberProperties
|
||||
.filter { it.visibility == KVisibility.PUBLIC }
|
||||
.filterNot { ignoreList.contains(it.name) }
|
||||
|
||||
@@ -52,11 +52,11 @@ class FeatureFlags_StaticValuesTest {
|
||||
|
||||
for (input in remoteTestInputs) {
|
||||
for (key in configKeys) {
|
||||
FeatureFlags.REMOTE_VALUES[key] = input
|
||||
RemoteConfig.REMOTE_VALUES[key] = input
|
||||
}
|
||||
|
||||
for (publicVal in publicVals) {
|
||||
val output: Any? = publicVal.getter.call(FeatureFlags)
|
||||
val output: Any? = publicVal.getter.call(RemoteConfig)
|
||||
val existingOutputs: MutableSet<Any?> = publicValOutputs.getOrDefault(publicVal.name, mutableSetOf())
|
||||
existingOutputs.add(output)
|
||||
publicValOutputs[publicVal.name] = existingOutputs
|
||||
Reference in New Issue
Block a user