test: fix flaky test
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package eventDemo.libs.command
|
package eventDemo.libs.command
|
||||||
|
|
||||||
|
import io.kotest.assertions.nondeterministic.eventually
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
@@ -8,6 +9,7 @@ import kotlinx.coroutines.GlobalScope
|
|||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class CommandTest(
|
class CommandTest(
|
||||||
@@ -34,6 +36,9 @@ class CommandStreamChannelTest :
|
|||||||
}
|
}
|
||||||
|
|
||||||
channel.send(command)
|
channel.send(command)
|
||||||
verify(exactly = 1) { spyCall() }
|
|
||||||
|
eventually(3.seconds) {
|
||||||
|
verify(exactly = 1) { spyCall() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user