Skip to content

Commit

Permalink
Add welcome email tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 authored and Brutus5000 committed Jan 5, 2024
1 parent a93a465 commit e7fce47
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import jakarta.inject.Inject
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.hasSize
import org.hamcrest.Matchers.`is`
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
Expand Down Expand Up @@ -64,7 +65,7 @@ class RegistrationServiceTest {
fun registerSuccess() {
registrationService.register(username, email)

val sent = mailbox.getMailMessagesSentTo(email)
val sent = mailbox.getMailsSentTo(email)
assertThat(sent, hasSize(1))
val actual = sent[0]
assertThat(actual.subject, `is`(fafProperties.account().registration().subject()))
Expand Down Expand Up @@ -103,6 +104,11 @@ class RegistrationServiceTest {
registrationService.activate(RegisteredUser(username, email), ipAddress, password)

verify(userRepository).persist(any<User>())

val sent = mailbox.getMailsSentTo(email)
assertThat(sent, hasSize(1))
val actual = sent[0]
assertEquals(fafProperties.account().registration().welcomeSubject(), actual.subject)
}

@Test
Expand Down

0 comments on commit e7fce47

Please sign in to comment.