mirror of
https://github.com/bitwarden/android.git
synced 2024-11-24 02:15:53 +03:00
PM-14851: Blank names should be considered null (#4292)
This commit is contained in:
parent
9a5aa217e6
commit
e804dbd48e
2 changed files with 24 additions and 1 deletions
|
@ -1302,7 +1302,7 @@ class AuthRepositoryImpl(
|
||||||
.sendVerificationEmail(
|
.sendVerificationEmail(
|
||||||
SendVerificationEmailRequestJson(
|
SendVerificationEmailRequestJson(
|
||||||
email = email,
|
email = email,
|
||||||
name = name,
|
name = name.takeUnless { it.isBlank() },
|
||||||
receiveMarketingEmails = receiveMarketingEmails,
|
receiveMarketingEmails = receiveMarketingEmails,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -6111,6 +6111,29 @@ class AuthRepositoryTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `sendVerificationEmail with empty name should use null and return success`() = runTest {
|
||||||
|
coEvery {
|
||||||
|
identityService.sendVerificationEmail(
|
||||||
|
SendVerificationEmailRequestJson(
|
||||||
|
email = EMAIL,
|
||||||
|
name = null,
|
||||||
|
receiveMarketingEmails = true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
} returns EMAIL_VERIFICATION_TOKEN.asSuccess()
|
||||||
|
|
||||||
|
val result = repository.sendVerificationEmail(
|
||||||
|
email = EMAIL,
|
||||||
|
name = "",
|
||||||
|
receiveMarketingEmails = true,
|
||||||
|
)
|
||||||
|
assertEquals(
|
||||||
|
SendVerificationEmailResult.Success(EMAIL_VERIFICATION_TOKEN),
|
||||||
|
result,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `sendVerificationEmail failure should return error`() = runTest {
|
fun `sendVerificationEmail failure should return error`() = runTest {
|
||||||
coEvery {
|
coEvery {
|
||||||
|
|
Loading…
Reference in a new issue