Skip to content

Commit

Permalink
Update UserPropertiesEventReceiverTest.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara authored Dec 16, 2024
1 parent deb21ba commit f56f1ce
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ class UserPropertiesEventReceiverTest {
}.wasInvoked(exactly = once)
}

// @Test
// fun givenFoldersUpdateEvent_repositoryIsInvoked() = runTest {
// val event = TestEvent.foldersUpdate()
// val (arrangement, eventReceiver) = Arrangement()
// .withUpdateConversationFolders()
// .arrange()
//
// eventReceiver.onEvent(event, TestEvent.liveDeliveryInfo)
//
// coVerify {
// arrangement.conversationFolderRepository.updateConversationFolders(any())
// }.wasInvoked(exactly = once)
// }
@Test
fun givenFoldersUpdateEvent_repositoryIsInvoked() = runTest {
val event = TestEvent.foldersUpdate()
val (arrangement, eventReceiver) = Arrangement()
.withUpdateConversationFolders()
.arrange()

eventReceiver.onEvent(event, TestEvent.liveDeliveryInfo)

coVerify {
arrangement.conversationFolderRepository.updateConversationFolders(any())
}.wasInvoked(exactly = once)
}

private class Arrangement {

Expand All @@ -80,11 +80,11 @@ class UserPropertiesEventReceiverTest {
}.returns(Either.Right(Unit))
}

// suspend fun withUpdateConversationFolders() = apply {
// coEvery {
// conversationFolderRepository.updateConversationFolders(any())
// }.returns(Either.Right(Unit))
// }
suspend fun withUpdateConversationFolders() = apply {
coEvery {
conversationFolderRepository.updateConversationFolders(any())
}.returns(Either.Right(Unit))
}

fun arrange() = this to userPropertiesEventReceiver
}
Expand Down

0 comments on commit f56f1ce

Please sign in to comment.