-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PM-17845 PM-17718 - Enable Remote Configuration for the import flow &…
… Rename Authenticator Sync Feature Flag Name (#4666)
- Loading branch information
1 parent
f004e10
commit 07fe6e5
Showing
2 changed files
with
126 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 124 additions & 62 deletions
186
app/src/test/java/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,141 @@ | ||
package com.x8bit.bitwarden.data.platform.manager | ||
|
||
import com.x8bit.bitwarden.data.platform.manager.model.FlagKey | ||
import org.junit.jupiter.api.Assertions.assertFalse | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
|
||
class FlagKeyTest { | ||
|
||
@Test | ||
fun `AuthenticatorSync default value should be false`() { | ||
assertFalse(FlagKey.AuthenticatorSync.defaultValue) | ||
fun `Feature flags have the correct key name set`() { | ||
assertEquals( | ||
FlagKey.AuthenticatorSync.keyName, | ||
"enable-pm-bwa-sync", | ||
) | ||
assertEquals( | ||
FlagKey.EmailVerification.keyName, | ||
"email-verification", | ||
) | ||
assertEquals( | ||
FlagKey.OnboardingCarousel.keyName, | ||
"native-carousel-flow", | ||
) | ||
assertEquals( | ||
FlagKey.OnboardingFlow.keyName, | ||
"native-create-account-flow", | ||
) | ||
assertEquals( | ||
FlagKey.ImportLoginsFlow.keyName, | ||
"import-logins-flow", | ||
) | ||
assertEquals( | ||
FlagKey.SshKeyCipherItems.keyName, | ||
"ssh-key-vault-item", | ||
) | ||
assertEquals( | ||
FlagKey.VerifiedSsoDomainEndpoint.keyName, | ||
"pm-12337-refactor-sso-details-endpoint", | ||
) | ||
assertEquals( | ||
FlagKey.CredentialExchangeProtocolImport.keyName, | ||
"cxp-import-mobile", | ||
) | ||
assertEquals( | ||
FlagKey.CredentialExchangeProtocolExport.keyName, | ||
"cxp-export-mobile", | ||
) | ||
assertEquals( | ||
FlagKey.AppReviewPrompt.keyName, | ||
"app-review-prompt", | ||
) | ||
assertEquals( | ||
FlagKey.CipherKeyEncryption.keyName, | ||
"cipher-key-encryption", | ||
) | ||
assertEquals( | ||
FlagKey.NewDeviceTemporaryDismiss.keyName, | ||
"new-device-temporary-dismiss", | ||
) | ||
assertEquals( | ||
FlagKey.NewDevicePermanentDismiss.keyName, | ||
"new-device-permanent-dismiss", | ||
) | ||
assertEquals( | ||
FlagKey.SingleTapPasskeyCreation.keyName, | ||
"single-tap-passkey-creation", | ||
) | ||
assertEquals( | ||
FlagKey.SingleTapPasskeyAuthentication.keyName, | ||
"single-tap-passkey-authentication", | ||
) | ||
assertEquals( | ||
FlagKey.IgnoreEnvironmentCheck.keyName, | ||
"ignore-environment-check", | ||
) | ||
assertEquals( | ||
FlagKey.MutualTls.keyName, | ||
"mutual-tls", | ||
) | ||
} | ||
|
||
@Test | ||
fun `AuthenticatorSync is remotely configured value should be true`() { | ||
assertTrue(FlagKey.AuthenticatorSync.isRemotelyConfigured) | ||
fun `All feature flags have the correct default value set`() { | ||
assertTrue( | ||
listOf( | ||
FlagKey.AuthenticatorSync, | ||
FlagKey.EmailVerification, | ||
FlagKey.OnboardingCarousel, | ||
FlagKey.OnboardingFlow, | ||
FlagKey.ImportLoginsFlow, | ||
FlagKey.SshKeyCipherItems, | ||
FlagKey.VerifiedSsoDomainEndpoint, | ||
FlagKey.CredentialExchangeProtocolImport, | ||
FlagKey.CredentialExchangeProtocolExport, | ||
FlagKey.AppReviewPrompt, | ||
FlagKey.NewDeviceTemporaryDismiss, | ||
FlagKey.NewDevicePermanentDismiss, | ||
FlagKey.SingleTapPasskeyCreation, | ||
FlagKey.SingleTapPasskeyAuthentication, | ||
).all { | ||
!it.defaultValue | ||
}, | ||
) | ||
|
||
assertTrue(FlagKey.CipherKeyEncryption.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `EmailVerification default value should be false`() { | ||
assertFalse(FlagKey.EmailVerification.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `OnboardingCarousel default value should be false`() { | ||
assertFalse(FlagKey.OnboardingCarousel.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `OnboardingFlow default value should be false`() { | ||
assertFalse(FlagKey.OnboardingFlow.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `ImportLoginsFlow default value should be false`() { | ||
assertFalse(FlagKey.ImportLoginsFlow.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `SshKeyCipherItems default value should be false`() { | ||
assertFalse(FlagKey.SshKeyCipherItems.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `AppReviewPrompt default value should be false`() { | ||
assertFalse(FlagKey.AppReviewPrompt.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `NewDevicePermanentDismiss default value should be false`() { | ||
assertFalse(FlagKey.NewDevicePermanentDismiss.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `NewDevicePermanentDismiss is remotely configured value should be true`() { | ||
assertTrue(FlagKey.NewDevicePermanentDismiss.isRemotelyConfigured) | ||
} | ||
|
||
@Test | ||
fun `NewDeviceTemporaryDismiss default value should be false`() { | ||
assertFalse(FlagKey.NewDeviceTemporaryDismiss.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `NewDeviceTemporaryDismiss is remotely configured value should be true`() { | ||
assertTrue(FlagKey.NewDeviceTemporaryDismiss.isRemotelyConfigured) | ||
} | ||
|
||
@Test | ||
fun `IgnoreEnvironmentCheck default value should be false`() { | ||
assertFalse(FlagKey.IgnoreEnvironmentCheck.defaultValue) | ||
} | ||
|
||
@Test | ||
fun `IgnoreEnvironmentCheck is remotely configured value should be false`() { | ||
assertFalse(FlagKey.IgnoreEnvironmentCheck.isRemotelyConfigured) | ||
fun `All feature flags are correctly set to be remotely configured`() { | ||
assertTrue( | ||
listOf( | ||
FlagKey.AuthenticatorSync, | ||
FlagKey.EmailVerification, | ||
FlagKey.OnboardingCarousel, | ||
FlagKey.OnboardingFlow, | ||
FlagKey.ImportLoginsFlow, | ||
FlagKey.SshKeyCipherItems, | ||
FlagKey.VerifiedSsoDomainEndpoint, | ||
FlagKey.CredentialExchangeProtocolImport, | ||
FlagKey.CredentialExchangeProtocolExport, | ||
FlagKey.AppReviewPrompt, | ||
FlagKey.CipherKeyEncryption, | ||
FlagKey.NewDeviceTemporaryDismiss, | ||
FlagKey.NewDevicePermanentDismiss, | ||
FlagKey.SingleTapPasskeyCreation, | ||
FlagKey.SingleTapPasskeyAuthentication, | ||
).all { | ||
it.isRemotelyConfigured | ||
}, | ||
) | ||
|
||
assertTrue( | ||
listOf( | ||
FlagKey.IgnoreEnvironmentCheck, | ||
FlagKey.MutualTls, | ||
).all { | ||
!it.isRemotelyConfigured | ||
}, | ||
) | ||
} | ||
} |