@ -24,6 +24,12 @@ class BrowserMenuSignInTest {
private lateinit var context : Context
private lateinit var components : Components
private val account : Account = mockk {
every { displayName } returns " bugzilla "
every { email } returns " bugzilla@mozilla.com "
}
private val accountWithNoDisplayName : Account = mockk {
every { displayName } returns null
every { email } returns " bugzilla@mozilla.com "
}
@ -37,11 +43,19 @@ class BrowserMenuSignInTest {
}
@Test
fun `WHEN signed in and has profile data, THEN show email `( ) {
fun `WHEN signed in and has profile data, THEN show display name `( ) {
every { components . backgroundServices . syncStore . state . account } returns account
every { components . settings . signedInFxaAccount } returns true
assertEquals ( account . email , BrowserMenuSignIn ( R . color . black ) . getLabel ( context ) )
assertEquals ( account . displayName , BrowserMenuSignIn ( R . color . black ) . getLabel ( context ) )
}
@Test
fun `WHEN signed in and has profile data but the display name is not set, THEN show email` ( ) {
every { components . backgroundServices . syncStore . state . account } returns accountWithNoDisplayName
every { components . settings . signedInFxaAccount } returns true
assertEquals ( accountWithNoDisplayName . email , BrowserMenuSignIn ( R . color . black ) . getLabel ( context ) )
}
@Test