Skip to content

Commit

Permalink
PM-14851: Blank names should be considered null (#4292)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-livefront authored Nov 12, 2024
1 parent 9a5aa21 commit e804dbd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ class AuthRepositoryImpl(
.sendVerificationEmail(
SendVerificationEmailRequestJson(
email = email,
name = name,
name = name.takeUnless { it.isBlank() },
receiveMarketingEmails = receiveMarketingEmails,
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
fun `sendVerificationEmail failure should return error`() = runTest {
coEvery {
Expand Down

0 comments on commit e804dbd

Please sign in to comment.