Skip to content

Commit

Permalink
fix: broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielcafe committed Aug 14, 2021
1 parent dede3b7 commit 9497086
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion hal-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
TestLib.all.forEach { testImplementation it }
}


afterEvaluate {
publishing {
publications {
Expand Down
16 changes: 3 additions & 13 deletions hal-core/src/test/kotlin/cafe/adriel/hal/StateObserverTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import cafe.adriel.hal.util.CustomStateObserver
import cafe.adriel.hal.util.TestCoroutineScopeRule
import cafe.adriel.hal.util.TurnstileState
import io.mockk.coVerify
import io.mockk.spyk
import io.mockk.mockk
import kotlinx.coroutines.flow.MutableStateFlow
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand All @@ -21,8 +20,8 @@ class StateObserverTest {
private lateinit var flowObserver: FlowStateObserver<TurnstileState>
private lateinit var customObserver: CustomStateObserver<TurnstileState>

private val flowListener = spyk(::flowOnStateChanged)
private val customListener = spyk(::customOnStateChanged)
private val flowListener = mockk<suspend (TurnstileState) -> Unit>(relaxed = true)
private val customListener = mockk<(TurnstileState) -> Unit>(relaxed = true)

@Before
fun setup() {
Expand All @@ -45,7 +44,6 @@ class StateObserverTest {
}

@Test
@Ignore("Broke after update Coroutines, needs investigation")
fun `when flow emits a state then flow observer calls listener`() {
coVerify { flowListener(TurnstileState.Locked) }
}
Expand All @@ -54,12 +52,4 @@ class StateObserverTest {
fun `when flow emits a state then custom observer calls listener`() {
coVerify { customListener(TurnstileState.Locked) }
}

private suspend fun flowOnStateChanged(state: TurnstileState) {
// Do nothing
}

private fun customOnStateChanged(state: TurnstileState) {
// Do nothing
}
}

0 comments on commit 9497086

Please sign in to comment.