Fix matching mailboxes when there is more than one space between words (#1964)

This commit is contained in:
Mikołaj Pich 2022-09-02 20:19:19 +02:00 committed by GitHub
parent 83ca9a7060
commit 157becb017
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View file

@ -91,6 +91,20 @@ class MailboxRepositoryTest {
assertEquals(expectedMailbox, systemUnderTest.getMailbox(student))
}
@Test
fun `get mailbox for unique non-authorized student but with spaces`() = runTest {
val student = getStudentEntity(
userName = "Stanisław Kowalski",
studentName = "J** K*******",
)
val expectedMailbox = getMailboxEntity("Jan Kowalski")
coEvery { mailboxDao.loadAll(any()) } returns listOf(
expectedMailbox,
)
assertEquals(expectedMailbox, systemUnderTest.getMailbox(student))
}
@Test(expected = IllegalArgumentException::class)
fun `get mailbox for not-unique non-authorized student`() = runTest {
val student = getStudentEntity(