mirror of
https://github.com/bitwarden/android.git
synced 2026-05-31 17:56:51 -05:00
BIT-1215: Improve handling of avatar initials for missing names (#308)
This commit is contained in:
@@ -12,7 +12,7 @@ class AccountSummaryExtensionsTest {
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `initials should return the starting letters of the first two words in the name if present`() {
|
||||
fun `initials should return the starting letters of the first two words for a multi-word name`() {
|
||||
assertEquals(
|
||||
"FS",
|
||||
mockk<AccountSummary>() {
|
||||
@@ -23,11 +23,24 @@ class AccountSummaryExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `initials should return a default value if the name is not present`() {
|
||||
fun `initials should return the first two letters of the name for a single word name`() {
|
||||
assertEquals(
|
||||
"..",
|
||||
"FI",
|
||||
mockk<AccountSummary>() {
|
||||
every { name } returns "First"
|
||||
}
|
||||
.initials,
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `initials should return the first two letters of the user's email if the name is not present`() {
|
||||
assertEquals(
|
||||
"TE",
|
||||
mockk<AccountSummary>() {
|
||||
every { name } returns null
|
||||
every { email } returns "test@bitwarden.com"
|
||||
}
|
||||
.initials,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user