mirror of
https://github.com/bitwarden/android.git
synced 2026-11-20 11:37:52 -06:00
BIT-515, BIT-512 Adding the ability to view and edit secure note items. (#462)
This commit is contained in:
committed by
Álison Fernandes
parent
fd9ca8f544
commit
1c8501b69b
@@ -1164,6 +1164,12 @@ private val EMPTY_IDENTITY_VIEW_STATE: VaultItemState.ViewState.Content =
|
||||
type = EMPTY_IDENTITY_TYPE,
|
||||
)
|
||||
|
||||
private val EMPTY_SECURE_NOTE_VIEW_STATE =
|
||||
VaultItemState.ViewState.Content(
|
||||
common = EMPTY_COMMON,
|
||||
type = VaultItemState.ViewState.Content.ItemType.SecureNote,
|
||||
)
|
||||
|
||||
private val DEFAULT_LOGIN_VIEW_STATE: VaultItemState.ViewState.Content =
|
||||
VaultItemState.ViewState.Content(
|
||||
type = DEFAULT_LOGIN,
|
||||
@@ -1176,12 +1182,20 @@ private val DEFAULT_IDENTITY_VIEW_STATE: VaultItemState.ViewState.Content =
|
||||
common = DEFAULT_COMMON,
|
||||
)
|
||||
|
||||
private val DEFAULT_SECURE_NOTE_VIEW_STATE: VaultItemState.ViewState.Content =
|
||||
VaultItemState.ViewState.Content(
|
||||
common = DEFAULT_COMMON,
|
||||
type = VaultItemState.ViewState.Content.ItemType.SecureNote,
|
||||
)
|
||||
|
||||
private val EMPTY_VIEW_STATES = listOf(
|
||||
EMPTY_LOGIN_VIEW_STATE,
|
||||
EMPTY_IDENTITY_VIEW_STATE,
|
||||
EMPTY_SECURE_NOTE_VIEW_STATE,
|
||||
)
|
||||
|
||||
private val DEFAULT_VIEW_STATES = listOf(
|
||||
DEFAULT_LOGIN_VIEW_STATE,
|
||||
DEFAULT_IDENTITY_VIEW_STATE,
|
||||
DEFAULT_SECURE_NOTE_VIEW_STATE,
|
||||
)
|
||||
|
||||
+29
@@ -170,4 +170,33 @@ class CipherViewExtensionsTest {
|
||||
result,
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toViewState should transform full CipherView into ViewState Secure Note Content with premium`() {
|
||||
val viewState = createCipherView(type = CipherType.SECURE_NOTE, isEmpty = false)
|
||||
.toViewState(isPremiumUser = true)
|
||||
|
||||
assertEquals(
|
||||
VaultItemState.ViewState.Content(
|
||||
common = createCommonContent(isEmpty = false),
|
||||
type = VaultItemState.ViewState.Content.ItemType.SecureNote,
|
||||
),
|
||||
viewState,
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toViewState should transform empty Secure Note CipherView into ViewState Secure Note Content`() {
|
||||
val viewState = createCipherView(type = CipherType.SECURE_NOTE, isEmpty = true)
|
||||
.toViewState(isPremiumUser = true)
|
||||
|
||||
val expectedState = VaultItemState.ViewState.Content(
|
||||
common = createCommonContent(isEmpty = true).copy(isPremiumUser = true),
|
||||
type = VaultItemState.ViewState.Content.ItemType.SecureNote,
|
||||
)
|
||||
|
||||
assertEquals(expectedState, viewState)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user