Skip to content

Commit

Permalink
#277 [test] SingleEventHandelr test
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Sep 15, 2023
1 parent e922ce3 commit 33a6630
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package hous.release.designsystem.util.single_event

import hous.release.testing.CoroutinesTestExtension
import io.mockk.every
import io.mockk.junit5.MockKExtension
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@OptIn(ExperimentalCoroutinesApi::class)
@ExtendWith(CoroutinesTestExtension::class)
@ExtendWith(MockKExtension::class)
internal class SingleEventHandlerTest {

@Test
fun `이벤트를 처리할 때 내부적으로 SingleEventHandleStrategy의 handle을 호출 한다`() {
// given
val mockStrategy = mockk<SingleEventHandleStrategy>(relaxed = true)
val handler = SingleEventHandler(mockStrategy)

// when
every { mockStrategy.handle(any()) } returns Unit
handler.handle { }
// then
verify(exactly = 1) { handler.handle(any()) }
}
}

0 comments on commit 33a6630

Please sign in to comment.