mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 20:09:59 +03:00
Adding DEFAULT_STATE to the GeneratorScreenTests.kt (#504)
This commit is contained in:
parent
2be770d5fc
commit
c964d8c830
1 changed files with 131 additions and 255 deletions
|
@ -39,21 +39,7 @@ import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
class GeneratorScreenTest : BaseComposeTest() {
|
class GeneratorScreenTest : BaseComposeTest() {
|
||||||
private var onNavigateToPasswordHistoryScreenCalled = false
|
private var onNavigateToPasswordHistoryScreenCalled = false
|
||||||
|
|
||||||
private val mutableStateFlow = MutableStateFlow(
|
private val mutableStateFlow = MutableStateFlow(DEFAULT_STATE)
|
||||||
GeneratorState(
|
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode(
|
|
||||||
GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode
|
|
||||||
.PasscodeType
|
|
||||||
.Password(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
private val mutableEventFlow = bufferedMutableSharedFlow<GeneratorEvent>()
|
private val mutableEventFlow = bufferedMutableSharedFlow<GeneratorEvent>()
|
||||||
private val viewModel = mockk<GeneratorViewModel>(relaxed = true) {
|
private val viewModel = mockk<GeneratorViewModel>(relaxed = true) {
|
||||||
|
@ -166,14 +152,14 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `clicking a UsernameOption should send UsernameTypeOption action`() {
|
fun `clicking a UsernameOption should send UsernameTypeOption action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.PlusAddressedEmail(
|
GeneratorState
|
||||||
email = "email",
|
.MainType
|
||||||
),
|
.Username
|
||||||
|
.UsernameType
|
||||||
|
.PlusAddressedEmail(),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -380,21 +366,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Password state, decrementing the minimum numbers counter should send MinNumbersCounterChange action`() {
|
fun `in Passcode_Password state, decrementing the minimum numbers counter should send MinNumbersCounterChange action`() {
|
||||||
val initialMinNumbers = 1
|
val initialMinNumbers = 1
|
||||||
updateState(
|
|
||||||
GeneratorState(
|
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode(
|
|
||||||
GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode
|
|
||||||
.PasscodeType
|
|
||||||
.Password(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
composeTestRule.onNodeWithContentDescription("Minimum numbers, 1")
|
composeTestRule.onNodeWithContentDescription("Minimum numbers, 1")
|
||||||
.onChildren()
|
.onChildren()
|
||||||
|
@ -415,21 +386,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Password state, incrementing the minimum numbers counter should send MinNumbersCounterChange action`() {
|
fun `in Passcode_Password state, incrementing the minimum numbers counter should send MinNumbersCounterChange action`() {
|
||||||
val initialMinNumbers = 1
|
val initialMinNumbers = 1
|
||||||
updateState(
|
|
||||||
GeneratorState(
|
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode(
|
|
||||||
GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode
|
|
||||||
.PasscodeType
|
|
||||||
.Password(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
composeTestRule.onNodeWithContentDescription("Minimum numbers, 1")
|
composeTestRule.onNodeWithContentDescription("Minimum numbers, 1")
|
||||||
.onChildren()
|
.onChildren()
|
||||||
|
@ -451,18 +407,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Password state, decrementing the minimum numbers counter below 0 should do nothing`() {
|
fun `in Passcode_Password state, decrementing the minimum numbers counter below 0 should do nothing`() {
|
||||||
val initialMinNumbers = 0
|
val initialMinNumbers = 0
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Password(
|
||||||
.Passcode
|
minNumbers = initialMinNumbers,
|
||||||
.PasscodeType
|
),
|
||||||
.Password(minNumbers = initialMinNumbers),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -480,18 +434,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Password state, incrementing the minimum numbers counter above 5 should do nothing`() {
|
fun `in Passcode_Password state, incrementing the minimum numbers counter above 5 should do nothing`() {
|
||||||
val initialMinNumbers = 5
|
val initialMinNumbers = 5
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Password(
|
||||||
.Passcode
|
minNumbers = initialMinNumbers,
|
||||||
.PasscodeType
|
),
|
||||||
.Password(minNumbers = initialMinNumbers),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -508,21 +460,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Password state, decrementing the minimum special characters counter should send MinSpecialCharactersChange action`() {
|
fun `in Passcode_Password state, decrementing the minimum special characters counter should send MinSpecialCharactersChange action`() {
|
||||||
val initialSpecialChars = 1
|
val initialSpecialChars = 1
|
||||||
updateState(
|
|
||||||
GeneratorState(
|
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode(
|
|
||||||
GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode
|
|
||||||
.PasscodeType
|
|
||||||
.Password(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
composeTestRule.onNodeWithContentDescription("Minimum special, 1")
|
composeTestRule.onNodeWithContentDescription("Minimum special, 1")
|
||||||
.onChildren()
|
.onChildren()
|
||||||
|
@ -543,21 +480,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Password state, incrementing the minimum special characters counter should send MinSpecialCharactersChange action`() {
|
fun `in Passcode_Password state, incrementing the minimum special characters counter should send MinSpecialCharactersChange action`() {
|
||||||
val initialSpecialChars = 1
|
val initialSpecialChars = 1
|
||||||
updateState(
|
|
||||||
GeneratorState(
|
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode(
|
|
||||||
GeneratorState
|
|
||||||
.MainType
|
|
||||||
.Passcode
|
|
||||||
.PasscodeType
|
|
||||||
.Password(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
composeTestRule.onNodeWithContentDescription("Minimum special, 1")
|
composeTestRule.onNodeWithContentDescription("Minimum special, 1")
|
||||||
.onChildren()
|
.onChildren()
|
||||||
|
@ -579,18 +501,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Password state, decrementing the minimum special characters below 0 should do nothing`() {
|
fun `in Passcode_Password state, decrementing the minimum special characters below 0 should do nothing`() {
|
||||||
val initialSpecialChars = 0
|
val initialSpecialChars = 0
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Password(
|
||||||
.Passcode
|
minSpecial = initialSpecialChars,
|
||||||
.PasscodeType
|
),
|
||||||
.Password(minSpecial = initialSpecialChars),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -608,18 +528,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Password state, decrementing the minimum special characters above 5 should do nothing`() {
|
fun `in Passcode_Password state, decrementing the minimum special characters above 5 should do nothing`() {
|
||||||
val initialSpecialChars = 5
|
val initialSpecialChars = 5
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Password(
|
||||||
.Passcode
|
minSpecial = initialSpecialChars,
|
||||||
.PasscodeType
|
),
|
||||||
.Password(minSpecial = initialSpecialChars),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -662,18 +580,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Passphrase state, decrementing number of words should send NumWordsCounterChange action with decremented value`() {
|
fun `in Passcode_Passphrase state, decrementing number of words should send NumWordsCounterChange action with decremented value`() {
|
||||||
val initialNumWords = 4
|
val initialNumWords = 4
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(
|
||||||
.Passcode
|
numWords = initialNumWords,
|
||||||
.PasscodeType
|
),
|
||||||
.Passphrase(numWords = initialNumWords),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -698,18 +614,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Passphrase state, decrementing number of words under 3 should do nothing`() {
|
fun `in Passcode_Passphrase state, decrementing number of words under 3 should do nothing`() {
|
||||||
val initialNumWords = 3
|
val initialNumWords = 3
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(
|
||||||
.Passcode
|
numWords = initialNumWords,
|
||||||
.PasscodeType
|
),
|
||||||
.Passphrase(numWords = initialNumWords),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -727,18 +641,16 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Passphrase state, incrementing number of words over 20 should do nothing`() {
|
fun `in Passcode_Passphrase state, incrementing number of words over 20 should do nothing`() {
|
||||||
val initialNumWords = 20
|
val initialNumWords = 20
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(
|
||||||
.Passcode
|
numWords = initialNumWords,
|
||||||
.PasscodeType
|
),
|
||||||
.Passphrase(numWords = initialNumWords),
|
),
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -757,18 +669,14 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
fun `in Passcode_Passphrase state, incrementing number of words should send NumWordsCounterChange action with incremented value`() {
|
fun `in Passcode_Passphrase state, incrementing number of words should send NumWordsCounterChange action with incremented value`() {
|
||||||
val initialNumWords = 3
|
val initialNumWords = 3
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(),
|
||||||
.Passcode
|
),
|
||||||
.PasscodeType
|
|
||||||
.Passphrase(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -792,18 +700,14 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Passphrase state, toggling capitalize should send ToggleCapitalizeChange action`() {
|
fun `in Passcode_Passphrase state, toggling capitalize should send ToggleCapitalizeChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(),
|
||||||
.Passcode
|
),
|
||||||
.PasscodeType
|
|
||||||
.Passphrase(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -825,18 +729,14 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Passphrase state, toggling the include number toggle should send ToggleIncludeNumberChange action`() {
|
fun `in Passcode_Passphrase state, toggling the include number toggle should send ToggleIncludeNumberChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(),
|
||||||
.Passcode
|
),
|
||||||
.PasscodeType
|
|
||||||
.Passphrase(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -857,18 +757,14 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Passcode_Passphrase state, updating text in word separator should send WordSeparatorTextChange action`() {
|
fun `in Passcode_Passphrase state, updating text in word separator should send WordSeparatorTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
selectedType = GeneratorState
|
GeneratorState
|
||||||
.MainType
|
.MainType
|
||||||
.Passcode(
|
.Passcode
|
||||||
GeneratorState
|
.PasscodeType
|
||||||
.MainType
|
.Passphrase(),
|
||||||
.Passcode
|
),
|
||||||
.PasscodeType
|
|
||||||
.Passphrase(),
|
|
||||||
),
|
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -894,14 +790,10 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias state, updating the service type should send ServiceTypeOptionSelect action`() {
|
fun `in Username_ForwardedEmailAlias state, updating the service type should send ServiceTypeOptionSelect action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(),
|
||||||
selectedServiceType = null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -948,8 +840,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_AddyIo state, updating access token text input should send AccessTokenTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_AddyIo state, updating access token text input should send AccessTokenTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -961,7 +852,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.AddyIo(),
|
.AddyIo(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -991,8 +881,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_AddyIo state, updating domain name text input should send DomainTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_AddyIo state, updating domain name text input should send DomainTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -1004,7 +893,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.AddyIo(),
|
.AddyIo(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1038,8 +926,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_DuckDuckGo state, updating api key text input should send ApiKeyTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_DuckDuckGo state, updating api key text input should send ApiKeyTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -1051,7 +938,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.DuckDuckGo(),
|
.DuckDuckGo(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1079,8 +965,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_FastMail state, updating api key text input should send ApiKeyTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_FastMail state, updating api key text input should send ApiKeyTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -1092,7 +977,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.FastMail(),
|
.FastMail(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1120,8 +1004,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_FirefoxRelay state, updating access token text input should send AccessTokenTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_FirefoxRelay state, updating access token text input should send AccessTokenTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -1133,7 +1016,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.FirefoxRelay(),
|
.FirefoxRelay(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1167,8 +1049,7 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_ForwardedEmailAlias_SimpleLogin state, updating api key text input should send ApiKeyTextChange action`() {
|
fun `in Username_ForwardedEmailAlias_SimpleLogin state, updating api key text input should send ApiKeyTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias(
|
||||||
selectedServiceType = GeneratorState
|
selectedServiceType = GeneratorState
|
||||||
|
@ -1180,7 +1061,6 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
.SimpleLogin(),
|
.SimpleLogin(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1208,14 +1088,10 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_PlusAddressedEmail state, updating text in email field should send EmailTextChange action`() {
|
fun `in Username_PlusAddressedEmail state, updating text in email field should send EmailTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.PlusAddressedEmail(
|
GeneratorState.MainType.Username.UsernameType.PlusAddressedEmail(),
|
||||||
email = "",
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1244,14 +1120,10 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_CatchAllEmail state, updating text in email field should send EmailTextChange action`() {
|
fun `in Username_CatchAllEmail state, updating text in email field should send EmailTextChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.CatchAllEmail(
|
GeneratorState.MainType.Username.UsernameType.CatchAllEmail(),
|
||||||
domainName = "",
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1280,12 +1152,10 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_RandomWord state, toggling capitalize should send ToggleCapitalizeChange action`() {
|
fun `in Username_RandomWord state, toggling capitalize should send ToggleCapitalizeChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.RandomWord(),
|
GeneratorState.MainType.Username.UsernameType.RandomWord(),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1306,12 +1176,10 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `in Username_RandomWord state, toggling the include number toggle should send ToggleIncludeNumberChange action`() {
|
fun `in Username_RandomWord state, toggling the include number toggle should send ToggleIncludeNumberChange action`() {
|
||||||
updateState(
|
updateState(
|
||||||
GeneratorState(
|
DEFAULT_STATE.copy(
|
||||||
generatedText = "Placeholder",
|
|
||||||
selectedType = GeneratorState.MainType.Username(
|
selectedType = GeneratorState.MainType.Username(
|
||||||
GeneratorState.MainType.Username.UsernameType.RandomWord(),
|
GeneratorState.MainType.Username.UsernameType.RandomWord(),
|
||||||
),
|
),
|
||||||
currentEmailAddress = "currentEmail",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1334,3 +1202,11 @@ class GeneratorScreenTest : BaseComposeTest() {
|
||||||
mutableStateFlow.value = state
|
mutableStateFlow.value = state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val DEFAULT_STATE = GeneratorState(
|
||||||
|
generatedText = "",
|
||||||
|
selectedType = GeneratorState.MainType.Passcode(
|
||||||
|
GeneratorState.MainType.Passcode.PasscodeType.Password(),
|
||||||
|
),
|
||||||
|
currentEmailAddress = "currentEmail",
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue