@@ -4056,6 +4056,58 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
4056
4056
assertEquals(expectedState, viewModel.stateFlow.value)
4057
4057
}
4058
4058
4059
+ @Suppress(" MaxLineLength" )
4060
+ @Test
4061
+ fun `CollectionSelect should update selectedOwnerId when isIndividualVaultDisabled is true` () =
4062
+ runTest {
4063
+ every {
4064
+ policyManager.getActivePolicies(type = PolicyTypeJson .PERSONAL_OWNERSHIP )
4065
+ } returns listOf (
4066
+ SyncResponseJson .Policy (
4067
+ organizationId = " Test Org" ,
4068
+ id = " testId" ,
4069
+ type = PolicyTypeJson .PERSONAL_OWNERSHIP ,
4070
+ isEnabled = true ,
4071
+ data = null ,
4072
+ ),
4073
+ )
4074
+
4075
+ val vaultAddEditType = VaultAddEditType .AddItem
4076
+ val vaultItemCipherType = VaultItemCipherType .LOGIN
4077
+ mutableVaultDataFlow.value = DataState .Loaded (
4078
+ data = createVaultData(),
4079
+ )
4080
+
4081
+ val viewModel = createAddVaultItemViewModel(
4082
+ savedStateHandle = createSavedStateHandleWithState(
4083
+ state = null ,
4084
+ vaultAddEditType = vaultAddEditType,
4085
+ vaultItemCipherType = vaultItemCipherType,
4086
+ ),
4087
+ )
4088
+
4089
+ val action = collectionSelectAction()
4090
+ viewModel.trySendAction(action)
4091
+
4092
+ val expectedState = vaultAddItemInitialState.copy(
4093
+ viewState = VaultAddEditState .ViewState .Content (
4094
+ common = createCommonContentViewState(
4095
+ availableOwners = listOf (
4096
+ VaultAddEditState .Owner (
4097
+ id = " organizationId" ,
4098
+ name = " organizationName" ,
4099
+ collections = emptyList(),
4100
+ ),
4101
+ ),
4102
+ selectedOwnerId = " organizationId" ,
4103
+ ),
4104
+ isIndividualVaultDisabled = true ,
4105
+ type = createLoginTypeContentViewState(),
4106
+ ),
4107
+ )
4108
+ assertEquals(expectedState, viewModel.stateFlow.value)
4109
+ }
4110
+
4059
4111
@Suppress(" MaxLineLength" )
4060
4112
@Test
4061
4113
fun `UserVerificationLockout should set isUserVerified to false and display Fido2ErrorDialog` () {
0 commit comments