[PM-10067] Show content on Vault screen when we have trashed items only (#3624)

This commit is contained in:
A. Bubnov
2024-07-25 10:54:21 -04:00
committed by GitHub
parent 793971c3a3
commit 5c2ac2e037
2 changed files with 38 additions and 1 deletions
@@ -61,7 +61,7 @@ fun VaultData.toViewState(
val noFolderItems = filteredCipherViewList
.filter { it.folderId.isNullOrBlank() }
return if (filteredCipherViewList.isEmpty()) {
return if (filteredCipherViewListWithDeletedItems.isEmpty()) {
VaultState.ViewState.NoItems
} else {
val totpItems = filteredCipherViewList.filter { it.login?.totp != null }
@@ -611,6 +611,43 @@ class VaultDataExtensionsTest {
)
}
@Test
fun `toViewState should show content with trashed items only`() {
val vaultData = VaultData(
cipherViewList = listOf(
createMockCipherView(number = 1, isDeleted = true),
createMockCipherView(number = 2, isDeleted = true),
),
collectionViewList = listOf(),
folderViewList = listOf(),
sendViewList = listOf(),
)
val actual = vaultData.toViewState(
isPremium = true,
isIconLoadingDisabled = false,
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
vaultFilterType = VaultFilterType.AllVaults,
hasMasterPassword = true,
)
assertEquals(
VaultState.ViewState.Content(
loginItemsCount = 0,
cardItemsCount = 0,
identityItemsCount = 0,
secureNoteItemsCount = 0,
favoriteItems = listOf(),
folderItems = listOf(),
collectionItems = listOf(),
noFolderItems = listOf(),
trashItemsCount = 2,
totpItemsCount = 0,
),
actual,
)
}
@Test
fun `toViewState with over 100 no folder items should show no folder option`() {
mockkStatic(Uri::class)