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

This commit is contained in:
A. Bubnov 2024-07-25 17:54:21 +03:00 committed by GitHub
parent 793971c3a3
commit 5c2ac2e037
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 1 deletions

View file

@ -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 }

View file

@ -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)