mirror of
https://github.com/bitwarden/android.git
synced 2024-11-22 01:16:02 +03:00
Simplify usages of turbineScope (#4167)
This commit is contained in:
parent
f8bf864fc9
commit
0960f61c37
8 changed files with 40 additions and 90 deletions
|
@ -4309,18 +4309,11 @@ class VaultRepositoryTest {
|
||||||
)
|
)
|
||||||
} returns Throwable().asFailure()
|
} returns Throwable().asFailure()
|
||||||
|
|
||||||
turbineScope {
|
val result = vaultRepository.getDecryptedFido2CredentialAutofillViews(
|
||||||
val expected = DecryptFido2CredentialAutofillViewResult.Error
|
|
||||||
val result = vaultRepository
|
|
||||||
.getDecryptedFido2CredentialAutofillViews(
|
|
||||||
cipherViewList = cipherViewList,
|
cipherViewList = cipherViewList,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(DecryptFido2CredentialAutofillViewResult.Error, result)
|
||||||
expected,
|
|
||||||
result,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
coVerify {
|
coVerify {
|
||||||
vaultSdkSource.decryptFido2CredentialAutofillViews(
|
vaultSdkSource.decryptFido2CredentialAutofillViews(
|
||||||
userId = MOCK_USER_STATE.activeUserId,
|
userId = MOCK_USER_STATE.activeUserId,
|
||||||
|
@ -4346,17 +4339,11 @@ class VaultRepositoryTest {
|
||||||
)
|
)
|
||||||
} returns autofillViewList.asSuccess()
|
} returns autofillViewList.asSuccess()
|
||||||
|
|
||||||
turbineScope {
|
val result = vaultRepository.getDecryptedFido2CredentialAutofillViews(
|
||||||
val result = vaultRepository
|
|
||||||
.getDecryptedFido2CredentialAutofillViews(
|
|
||||||
cipherViewList = cipherViewList,
|
cipherViewList = cipherViewList,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(expected, result)
|
||||||
expected,
|
|
||||||
result,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
coVerify {
|
coVerify {
|
||||||
vaultSdkSource.decryptFido2CredentialAutofillViews(
|
vaultSdkSource.decryptFido2CredentialAutofillViews(
|
||||||
userId = MOCK_USER_STATE.activeUserId,
|
userId = MOCK_USER_STATE.activeUserId,
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.auth.feature.completeregistration
|
||||||
|
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_0
|
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_0
|
||||||
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_1
|
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_1
|
||||||
|
@ -154,9 +153,7 @@ class CompleteRegistrationViewModelTest : BaseViewModelTest() {
|
||||||
)
|
)
|
||||||
} returns RegisterResult.Success(captchaToken = CAPTCHA_BYPASS_TOKEN)
|
} returns RegisterResult.Success(captchaToken = CAPTCHA_BYPASS_TOKEN)
|
||||||
val viewModel = createCompleteRegistrationViewModel(VALID_INPUT_STATE)
|
val viewModel = createCompleteRegistrationViewModel(VALID_INPUT_STATE)
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
||||||
viewModel.trySendAction(CompleteRegistrationAction.CallToActionClick)
|
viewModel.trySendAction(CompleteRegistrationAction.CallToActionClick)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.auth.feature.createaccount
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_0
|
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_0
|
||||||
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_1
|
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength.LEVEL_1
|
||||||
|
@ -243,9 +242,7 @@ class CreateAccountViewModelTest : BaseViewModelTest() {
|
||||||
savedStateHandle = validInputHandle,
|
savedStateHandle = validInputHandle,
|
||||||
authRepository = repo,
|
authRepository = repo,
|
||||||
)
|
)
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
||||||
viewModel.trySendAction(CreateAccountAction.SubmitClick)
|
viewModel.trySendAction(CreateAccountAction.SubmitClick)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.auth.feature.enterprisesignon
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
||||||
import com.x8bit.bitwarden.data.auth.repository.model.LoginResult
|
import com.x8bit.bitwarden.data.auth.repository.model.LoginResult
|
||||||
|
@ -511,10 +510,7 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() {
|
||||||
)
|
)
|
||||||
val ssoCallbackResult = SsoCallbackResult.Success(state = "abc", code = "lmn")
|
val ssoCallbackResult = SsoCallbackResult.Success(state = "abc", code = "lmn")
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
assertEquals(initialState, stateFlow.awaitItem())
|
assertEquals(initialState, stateFlow.awaitItem())
|
||||||
|
|
||||||
mutableSsoCallbackResultFlow.tryEmit(ssoCallbackResult)
|
mutableSsoCallbackResultFlow.tryEmit(ssoCallbackResult)
|
||||||
|
@ -566,10 +562,7 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() {
|
||||||
)
|
)
|
||||||
val ssoCallbackResult = SsoCallbackResult.Success(state = "abc", code = "lmn")
|
val ssoCallbackResult = SsoCallbackResult.Success(state = "abc", code = "lmn")
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
assertEquals(initialState, stateFlow.awaitItem())
|
assertEquals(initialState, stateFlow.awaitItem())
|
||||||
|
|
||||||
mutableSsoCallbackResultFlow.tryEmit(ssoCallbackResult)
|
mutableSsoCallbackResultFlow.tryEmit(ssoCallbackResult)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.auth.feature.startregistration
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
||||||
import com.x8bit.bitwarden.data.auth.repository.model.SendVerificationEmailResult
|
import com.x8bit.bitwarden.data.auth.repository.model.SendVerificationEmailResult
|
||||||
|
@ -177,9 +176,7 @@ class StartRegistrationViewModelTest : BaseViewModelTest() {
|
||||||
environmentRepository = fakeEnvironmentRepository,
|
environmentRepository = fakeEnvironmentRepository,
|
||||||
featureFlagManager = featureFlagManager,
|
featureFlagManager = featureFlagManager,
|
||||||
)
|
)
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
assertEquals(VALID_INPUT_STATE, stateFlow.awaitItem())
|
||||||
viewModel.trySendAction(ContinueClick)
|
viewModel.trySendAction(ContinueClick)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.vault.feature.addedit
|
||||||
import android.content.pm.SigningInfo
|
import android.content.pm.SigningInfo
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.bitwarden.send.SendView
|
import com.bitwarden.send.SendView
|
||||||
import com.bitwarden.vault.CipherView
|
import com.bitwarden.vault.CipherView
|
||||||
import com.bitwarden.vault.CollectionView
|
import com.bitwarden.vault.CollectionView
|
||||||
|
@ -611,25 +610,22 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
vaultRepository.createCipherInOrganization(any(), any())
|
vaultRepository.createCipherInOrganization(any(), any())
|
||||||
} returns CreateCipherResult.Success
|
} returns CreateCipherResult.Success
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateTurbine = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithDialog, stateTurbine.awaitItem())
|
assertEquals(stateWithDialog, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.ShowToast(
|
VaultAddEditEvent.ShowToast(
|
||||||
R.string.new_item_created.asText(),
|
R.string.new_item_created.asText(),
|
||||||
),
|
),
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.NavigateBack,
|
VaultAddEditEvent.NavigateBack,
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
coVerify(exactly = 1) {
|
coVerify(exactly = 1) {
|
||||||
|
@ -680,19 +676,16 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
vaultRepository.createCipherInOrganization(any(), any())
|
vaultRepository.createCipherInOrganization(any(), any())
|
||||||
} returns CreateCipherResult.Success
|
} returns CreateCipherResult.Success
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateTurbine = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithDialog, stateTurbine.awaitItem())
|
assertEquals(stateWithDialog, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.ExitApp,
|
VaultAddEditEvent.ExitApp,
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
assertNull(specialCircumstanceManager.specialCircumstance)
|
assertNull(specialCircumstanceManager.specialCircumstance)
|
||||||
|
@ -821,17 +814,14 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
} returns mockAttestationOptions
|
} returns mockAttestationOptions
|
||||||
every { authRepository.activeUserId } returns "mockUserId"
|
every { authRepository.activeUserId } returns "mockUserId"
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateTurbine = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
assertEquals(stateWithNewLogin, stateTurbine.awaitItem())
|
assertEquals(stateWithNewLogin, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithSavingDialog, stateTurbine.awaitItem())
|
assertEquals(stateWithSavingDialog, stateFlow.awaitItem())
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.Fido2UserVerification(isRequired = true),
|
VaultAddEditEvent.Fido2UserVerification(isRequired = true),
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -899,22 +889,19 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
} returns mockAttestationOptions
|
} returns mockAttestationOptions
|
||||||
every { authRepository.activeUserId } returns mockUserId
|
every { authRepository.activeUserId } returns mockUserId
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateTurbine = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
assertEquals(stateWithSavingDialog, stateTurbine.awaitItem())
|
assertEquals(stateWithSavingDialog, stateFlow.awaitItem())
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.ShowToast(R.string.item_updated.asText()),
|
VaultAddEditEvent.ShowToast(R.string.item_updated.asText()),
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
assertEquals(stateWithName, stateTurbine.awaitItem())
|
assertEquals(stateWithName, stateFlow.awaitItem())
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.CompleteFido2Registration(mockCreateResult),
|
VaultAddEditEvent.CompleteFido2Registration(mockCreateResult),
|
||||||
eventTurbine.awaitItem(),
|
eventFlow.awaitItem(),
|
||||||
)
|
)
|
||||||
coVerify(exactly = 1) {
|
coVerify(exactly = 1) {
|
||||||
fido2CredentialManager.registerFido2Credential(
|
fido2CredentialManager.registerFido2Credential(
|
||||||
|
@ -1059,11 +1046,10 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
turbineScope {
|
viewModel.eventFlow.test {
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.Fido2UserVerification(isRequired = false),
|
VaultAddEditEvent.Fido2UserVerification(isRequired = false),
|
||||||
eventTurbine.awaitItem(),
|
awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1105,11 +1091,10 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||||
|
|
||||||
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
viewModel.trySendAction(VaultAddEditAction.Common.SaveClick)
|
||||||
|
|
||||||
turbineScope {
|
viewModel.eventFlow.test {
|
||||||
val eventTurbine = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultAddEditEvent.Fido2UserVerification(isRequired = true),
|
VaultAddEditEvent.Fido2UserVerification(isRequired = true),
|
||||||
eventTurbine.awaitItem(),
|
awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.x8bit.bitwarden.ui.vault.feature.importlogins
|
package com.x8bit.bitwarden.ui.vault.feature.importlogins
|
||||||
|
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.vault.repository.VaultRepository
|
import com.x8bit.bitwarden.data.vault.repository.VaultRepository
|
||||||
import com.x8bit.bitwarden.data.vault.repository.model.SyncVaultDataResult
|
import com.x8bit.bitwarden.data.vault.repository.model.SyncVaultDataResult
|
||||||
|
@ -95,9 +94,7 @@ class ImportLoginsViewModelTest : BaseViewModelTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `ConfirmImportLater sets dialog state to null and sends NavigateBack event`() = runTest {
|
fun `ConfirmImportLater sets dialog state to null and sends NavigateBack event`() = runTest {
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
// Initial state
|
// Initial state
|
||||||
assertEquals(DEFAULT_STATE, stateFlow.awaitItem())
|
assertEquals(DEFAULT_STATE, stateFlow.awaitItem())
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.ui.vault.feature.item
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.lifecycle.SavedStateHandle
|
import androidx.lifecycle.SavedStateHandle
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import app.cash.turbine.turbineScope
|
|
||||||
import com.bitwarden.vault.CipherView
|
import com.bitwarden.vault.CipherView
|
||||||
import com.x8bit.bitwarden.R
|
import com.x8bit.bitwarden.R
|
||||||
import com.x8bit.bitwarden.data.auth.datasource.disk.model.OnboardingStatus
|
import com.x8bit.bitwarden.data.auth.datasource.disk.model.OnboardingStatus
|
||||||
|
@ -653,9 +652,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||||
val loginState = DEFAULT_STATE.copy(viewState = loginViewState)
|
val loginState = DEFAULT_STATE.copy(viewState = loginViewState)
|
||||||
val viewModel = createViewModel(state = loginState)
|
val viewModel = createViewModel(state = loginState)
|
||||||
|
|
||||||
turbineScope {
|
viewModel.stateEventFlow(backgroundScope) { stateFlow, eventFlow ->
|
||||||
val stateFlow = viewModel.stateFlow.testIn(backgroundScope)
|
|
||||||
val eventFlow = viewModel.eventFlow.testIn(backgroundScope)
|
|
||||||
assertEquals(loginState, stateFlow.awaitItem())
|
assertEquals(loginState, stateFlow.awaitItem())
|
||||||
viewModel.trySendAction(
|
viewModel.trySendAction(
|
||||||
VaultItemAction.Common.MasterPasswordSubmit(
|
VaultItemAction.Common.MasterPasswordSubmit(
|
||||||
|
|
Loading…
Reference in a new issue