mirror of
https://github.com/bitwarden/android.git
synced 2026-08-30 17:33:42 -05:00
🍒 [PM-21537] Fix remove individual vault collection selection cherrypick (#5261)
This commit is contained in:
+2
-1
@@ -960,11 +960,12 @@ class VaultAddEditViewModel @Inject constructor(
|
||||
) {
|
||||
updateCommonContent { currentCommonContentState ->
|
||||
currentCommonContentState.copy(
|
||||
selectedOwnerId = currentCommonContentState.selectedOwner?.id,
|
||||
availableOwners = currentCommonContentState
|
||||
.availableOwners
|
||||
.toUpdatedOwners(
|
||||
selectedCollectionId = action.collection.id,
|
||||
selectedOwnerId = currentCommonContentState.selectedOwnerId,
|
||||
selectedOwnerId = currentCommonContentState.selectedOwner?.id,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
+52
@@ -4056,6 +4056,58 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
||||
assertEquals(expectedState, viewModel.stateFlow.value)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `CollectionSelect should update selectedOwnerId when isIndividualVaultDisabled is true`() =
|
||||
runTest {
|
||||
every {
|
||||
policyManager.getActivePolicies(type = PolicyTypeJson.PERSONAL_OWNERSHIP)
|
||||
} returns listOf(
|
||||
SyncResponseJson.Policy(
|
||||
organizationId = "Test Org",
|
||||
id = "testId",
|
||||
type = PolicyTypeJson.PERSONAL_OWNERSHIP,
|
||||
isEnabled = true,
|
||||
data = null,
|
||||
),
|
||||
)
|
||||
|
||||
val vaultAddEditType = VaultAddEditType.AddItem
|
||||
val vaultItemCipherType = VaultItemCipherType.LOGIN
|
||||
mutableVaultDataFlow.value = DataState.Loaded(
|
||||
data = createVaultData(),
|
||||
)
|
||||
|
||||
val viewModel = createAddVaultItemViewModel(
|
||||
savedStateHandle = createSavedStateHandleWithState(
|
||||
state = null,
|
||||
vaultAddEditType = vaultAddEditType,
|
||||
vaultItemCipherType = vaultItemCipherType,
|
||||
),
|
||||
)
|
||||
|
||||
val action = collectionSelectAction()
|
||||
viewModel.trySendAction(action)
|
||||
|
||||
val expectedState = vaultAddItemInitialState.copy(
|
||||
viewState = VaultAddEditState.ViewState.Content(
|
||||
common = createCommonContentViewState(
|
||||
availableOwners = listOf(
|
||||
VaultAddEditState.Owner(
|
||||
id = "organizationId",
|
||||
name = "organizationName",
|
||||
collections = emptyList(),
|
||||
),
|
||||
),
|
||||
selectedOwnerId = "organizationId",
|
||||
),
|
||||
isIndividualVaultDisabled = true,
|
||||
type = createLoginTypeContentViewState(),
|
||||
),
|
||||
)
|
||||
assertEquals(expectedState, viewModel.stateFlow.value)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `UserVerificationLockout should set isUserVerified to false and display Fido2ErrorDialog`() {
|
||||
|
||||
Reference in New Issue
Block a user