mirror of
https://github.com/bitwarden/android.git
synced 2026-10-22 11:02:51 -05:00
fixed tests
This commit is contained in:
9 files changed
+35
-13
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ import android.view.MotionEvent
|
||||
import com.x8bit.bitwarden.data.platform.repository.DebugMenuRepository
|
||||
|
||||
private const val TAP_TIME_THRESHOLD_MILLIS = 500
|
||||
private const val POINTERS_REQUIRED = 2
|
||||
private const val POINTERS_REQUIRED = 3
|
||||
|
||||
/**
|
||||
* Default implementation of the [DebugMenuLaunchManager]
|
||||
|
||||
@@ -184,16 +184,6 @@ class VaultItemViewModel @Inject constructor(
|
||||
.onEach(::sendAction)
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
featureFlagManager.getFeatureFlagFlow(FlagKey.ArchiveItem)
|
||||
.map { isArchiveEnabled ->
|
||||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
isArchiveItemEnabled = isArchiveEnabled,
|
||||
)
|
||||
}
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
settingsRepository.isIconLoadingDisabledFlow
|
||||
.map { VaultItemAction.Internal.IsIconLoadingDisabledUpdateReceive(it) }
|
||||
.onEach(::sendAction)
|
||||
|
||||
+7
@@ -44,6 +44,7 @@ class AutofillCipherProviderTest {
|
||||
private val cardCipherView: CipherView = mockk {
|
||||
every { card } returns cardView
|
||||
every { deletedDate } returns null
|
||||
every { archivedDate } returns null
|
||||
every { id } returns CIPHER_ID
|
||||
every { name } returns CARD_NAME
|
||||
every { reprompt } returns CipherRepromptType.NONE
|
||||
@@ -56,6 +57,7 @@ class AutofillCipherProviderTest {
|
||||
}
|
||||
private val loginCipherViewWithoutTotp: CipherView = mockk {
|
||||
every { deletedDate } returns null
|
||||
every { archivedDate } returns null
|
||||
every { id } returns CIPHER_ID
|
||||
every { login } returns loginViewWithoutTotp
|
||||
every { name } returns LOGIN_NAME
|
||||
@@ -69,6 +71,7 @@ class AutofillCipherProviderTest {
|
||||
}
|
||||
private val loginCipherViewWithTotp: CipherView = mockk {
|
||||
every { deletedDate } returns null
|
||||
every { archivedDate } returns null
|
||||
every { id } returns CIPHER_ID
|
||||
every { login } returns loginViewWithTotp
|
||||
every { name } returns LOGIN_NAME
|
||||
@@ -210,10 +213,12 @@ class AutofillCipherProviderTest {
|
||||
runTest {
|
||||
val deletedCardCipherView: CipherView = mockk {
|
||||
every { deletedDate } returns mockk()
|
||||
every { archivedDate } returns null
|
||||
every { type } returns CipherType.CARD
|
||||
}
|
||||
val repromptCardCipherView: CipherView = mockk {
|
||||
every { deletedDate } returns null
|
||||
every { archivedDate } returns null
|
||||
every { reprompt } returns CipherRepromptType.PASSWORD
|
||||
every { type } returns CipherType.CARD
|
||||
}
|
||||
@@ -282,10 +287,12 @@ class AutofillCipherProviderTest {
|
||||
runTest {
|
||||
val deletedLoginCipherView: CipherView = mockk {
|
||||
every { deletedDate } returns mockk()
|
||||
every { archivedDate } returns null
|
||||
every { type } returns CipherType.LOGIN
|
||||
}
|
||||
val repromptLoginCipherView: CipherView = mockk {
|
||||
every { deletedDate } returns null
|
||||
every { archivedDate } returns null
|
||||
every { reprompt } returns CipherRepromptType.PASSWORD
|
||||
every { type } returns CipherType.LOGIN
|
||||
}
|
||||
|
||||
+2
@@ -1535,6 +1535,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
SearchTypeData.Vault.SecureNotes -> "search_type_vault_secure_notes"
|
||||
SearchTypeData.Vault.VerificationCodes -> "search_type_vault_verification_codes"
|
||||
SearchTypeData.Vault.Trash -> "search_type_vault_trash"
|
||||
SearchTypeData.Vault.Archive -> "search_type_vault_archive"
|
||||
null -> "search_type_vault_all"
|
||||
},
|
||||
)
|
||||
@@ -1555,6 +1556,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
SearchTypeData.Vault.SecureNotes -> null
|
||||
SearchTypeData.Vault.VerificationCodes -> null
|
||||
SearchTypeData.Vault.Trash -> null
|
||||
SearchTypeData.Vault.Archive -> null
|
||||
null -> null
|
||||
},
|
||||
)
|
||||
|
||||
+2
@@ -4578,6 +4578,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
is VaultItemListingType.SendFile -> "send_file"
|
||||
is VaultItemListingType.SendText -> "send_text"
|
||||
is VaultItemListingType.SshKey -> "ssh_key"
|
||||
is VaultItemListingType.Archive -> "archive"
|
||||
},
|
||||
)
|
||||
set(
|
||||
@@ -4593,6 +4594,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
is VaultItemListingType.SendFile -> null
|
||||
is VaultItemListingType.SendText -> null
|
||||
is VaultItemListingType.SshKey -> null
|
||||
is VaultItemListingType.Archive -> null
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ class VaultScreenTest : BaseComposeTest() {
|
||||
}
|
||||
// Header
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = "TRASH (1)")
|
||||
.onNodeWithTextAfterScroll(text = "HIDDEN ITEMS (2)")
|
||||
.assertIsDisplayed()
|
||||
// Item
|
||||
composeTestRule
|
||||
@@ -1169,7 +1169,7 @@ class VaultScreenTest : BaseComposeTest() {
|
||||
|
||||
// Header
|
||||
composeTestRule
|
||||
.onNodeWithTextAfterScroll(text = "TRASH (1)")
|
||||
.onNodeWithTextAfterScroll(text = "HIDDEN ITEMS (2)")
|
||||
.assertIsDisplayed()
|
||||
// Item
|
||||
composeTestRule
|
||||
@@ -1441,4 +1441,5 @@ private val DEFAULT_CONTENT_VIEW_STATE: VaultState.ViewState.Content = VaultStat
|
||||
totpItemsCount = 0,
|
||||
itemTypesCount = 4,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
)
|
||||
@@ -705,6 +705,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = CipherType.entries.size,
|
||||
sshKeyItemsCount = 1,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
),
|
||||
viewModel.stateFlow.value,
|
||||
@@ -729,6 +730,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
)
|
||||
val viewModel = createViewModel()
|
||||
@@ -843,6 +845,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
),
|
||||
viewModel.stateFlow.value,
|
||||
@@ -943,6 +946,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
dialog = VaultState.DialogState.Error(
|
||||
title = R.string.an_error_has_occurred.asText(),
|
||||
@@ -1041,6 +1045,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
dialog = null,
|
||||
),
|
||||
@@ -1118,6 +1123,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = CipherType.entries.size,
|
||||
sshKeyItemsCount = 1,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
),
|
||||
viewModel.stateFlow.value,
|
||||
|
||||
+13
@@ -100,6 +100,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -146,6 +147,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -207,6 +209,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -290,6 +293,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -327,6 +331,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 0,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -364,6 +369,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -403,6 +409,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -626,6 +633,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -665,6 +673,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 0,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -713,6 +722,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 100,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -790,6 +800,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 5,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -832,6 +843,7 @@ class VaultDataExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
// Verify item types count includes all CipherTypes when showSshKeys is true.
|
||||
itemTypesCount = CipherType.entries.size,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
@@ -902,6 +914,7 @@ class VaultDataExtensionsTest {
|
||||
trashItemsCount = 0,
|
||||
totpItemsCount = 0,
|
||||
itemTypesCount = CipherType.entries.size,
|
||||
archiveItemsCount = 0,
|
||||
),
|
||||
actual,
|
||||
)
|
||||
|
||||
+1
@@ -85,5 +85,6 @@ class VaultStateExtensionsTest {
|
||||
totpItemsCount = 1,
|
||||
itemTypesCount = 4,
|
||||
sshKeyItemsCount = 0,
|
||||
archiveItemsCount = 0,
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user