Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JcMinarro committed Apr 29, 2024
1 parent ea85c25 commit 6c39def
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal class ChannelRepositoryImplTest {
@Test
fun `Given channel without messages in DB, Should insert channel with updated last message`() = runTest {
val channel = randomChannel(messages = emptyList())
val lastMessage = randomMessage(createdAt = Date())
val lastMessage = randomMessage(createdAt = Date(), parentId = null)
whenever(channelDao.select("cid")) doReturn channel.toEntity()

channelRepository.updateLastMessageForChannel("cid", lastMessage)
Expand All @@ -89,8 +89,8 @@ internal class ChannelRepositoryImplTest {
fun `Given channel with outdated lastMessage in DB, Should insert channel with updated last message`() = runTest {
val before = Date(1000)
val after = Date(2000)
val outdatedMessage = randomMessage(id = "messageId1", createdAt = before)
val newLastMessage = randomMessage(id = "messageId2", createdAt = after)
val outdatedMessage = randomMessage(id = "messageId1", createdAt = before, parentId = null)
val newLastMessage = randomMessage(id = "messageId2", createdAt = after, parentId = null)
val channel = randomChannel(messages = listOf(outdatedMessage), lastMessageAt = before)
whenever(channelDao.select(cid = "cid")) doReturn channel.toEntity()

Expand Down

0 comments on commit 6c39def

Please sign in to comment.