Fix tests
This commit is contained in:
@@ -7,7 +7,7 @@ import eventDemo.business.event.projection.projectionListener.ReactionListener
|
||||
import org.koin.core.Koin
|
||||
|
||||
fun Koin.configureGameListener() {
|
||||
get<ReactionListener>()
|
||||
get<GameCommandHandler>()
|
||||
.subscribeToBus(get())
|
||||
|
||||
get<GameStateRepositoryInMemory>()
|
||||
@@ -16,6 +16,6 @@ fun Koin.configureGameListener() {
|
||||
get<GameListRepositoryInMemory>()
|
||||
.subscribeToBus(get(), get())
|
||||
|
||||
get<GameCommandHandler>()
|
||||
get<ReactionListener>()
|
||||
.subscribeToBus(get())
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import eventDemo.business.event.event.PlayerReadyEvent
|
||||
import eventDemo.business.event.projection.gameList.GameList
|
||||
import eventDemo.testApplicationWithConfig
|
||||
import io.kotest.assertions.nondeterministic.eventually
|
||||
import io.kotest.assertions.nondeterministic.eventuallyConfig
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.collections.shouldContain
|
||||
import io.kotest.matchers.collections.shouldHaveSize
|
||||
@@ -22,6 +23,7 @@ import io.ktor.http.HttpStatusCode
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class GameListRouteTest :
|
||||
@@ -57,7 +59,12 @@ class GameListRouteTest :
|
||||
},
|
||||
) {
|
||||
// Wait until the projection is created
|
||||
eventually(3.seconds) {
|
||||
eventually(
|
||||
eventuallyConfig {
|
||||
duration = 3.seconds
|
||||
interval = 300.milliseconds
|
||||
},
|
||||
) {
|
||||
httpClient()
|
||||
.get("/games") {
|
||||
withAuth(player1)
|
||||
|
||||
@@ -82,9 +82,6 @@ class GameSimulationTest :
|
||||
assertIs<CommandSuccessNotification>(it).commandId shouldBeEqual sendCommand.id
|
||||
}
|
||||
}
|
||||
channelNotification1.receive().let {
|
||||
assertIs<PlayerWasReadyNotification>(it).player shouldBeEqual player2
|
||||
}
|
||||
val player1Hand =
|
||||
channelNotification1.receive().let {
|
||||
assertIs<TheGameWasStartedNotification>(it).hand shouldHaveSize 7
|
||||
@@ -95,6 +92,9 @@ class GameSimulationTest :
|
||||
player shouldBeEqual player1
|
||||
}
|
||||
}
|
||||
channelNotification1.receive().let {
|
||||
assertIs<PlayerWasReadyNotification>(it).player shouldBeEqual player2
|
||||
}
|
||||
|
||||
IWantToPlayCardCommand(IWantToPlayCardCommand.Payload(gameId, player1, player1Hand.first())).also { sendCommand ->
|
||||
channelCommand1.send(sendCommand)
|
||||
|
||||
Reference in New Issue
Block a user