Skip to content

Commit 9497086

Browse files
committed
fix: broken test
1 parent dede3b7 commit 9497086

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

hal-core/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies {
1515
TestLib.all.forEach { testImplementation it }
1616
}
1717

18-
1918
afterEvaluate {
2019
publishing {
2120
publications {

hal-core/src/test/kotlin/cafe/adriel/hal/StateObserverTest.kt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import cafe.adriel.hal.util.CustomStateObserver
55
import cafe.adriel.hal.util.TestCoroutineScopeRule
66
import cafe.adriel.hal.util.TurnstileState
77
import io.mockk.coVerify
8-
import io.mockk.spyk
8+
import io.mockk.mockk
99
import kotlinx.coroutines.flow.MutableStateFlow
1010
import org.junit.Before
11-
import org.junit.Ignore
1211
import org.junit.Rule
1312
import org.junit.Test
1413

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

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

2726
@Before
2827
fun setup() {
@@ -45,7 +44,6 @@ class StateObserverTest {
4544
}
4645

4746
@Test
48-
@Ignore("Broke after update Coroutines, needs investigation")
4947
fun `when flow emits a state then flow observer calls listener`() {
5048
coVerify { flowListener(TurnstileState.Locked) }
5149
}
@@ -54,12 +52,4 @@ class StateObserverTest {
5452
fun `when flow emits a state then custom observer calls listener`() {
5553
coVerify { customListener(TurnstileState.Locked) }
5654
}
57-
58-
private suspend fun flowOnStateChanged(state: TurnstileState) {
59-
// Do nothing
60-
}
61-
62-
private fun customOnStateChanged(state: TurnstileState) {
63-
// Do nothing
64-
}
6555
}

0 commit comments

Comments
 (0)