move subscribeToBus in configureGameListener function, and use it on test

This commit is contained in:
2025-03-30 03:08:36 +02:00
parent d5d6a48df3
commit 2fb4c778fd
10 changed files with 104 additions and 37 deletions

View File

@@ -13,7 +13,6 @@ import eventDemo.business.event.event.disableShuffleDeck
import eventDemo.business.event.projection.gameState.GameState
import eventDemo.business.event.projection.gameState.apply
import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener
import eventDemo.business.event.projection.projectionListener.ReactionListener
import eventDemo.business.notification.CommandSuccessNotification
import eventDemo.business.notification.ItsTheTurnOfNotification
import eventDemo.business.notification.Notification
@@ -22,6 +21,7 @@ import eventDemo.business.notification.PlayerAsPlayACardNotification
import eventDemo.business.notification.PlayerWasReadyNotification
import eventDemo.business.notification.TheGameWasStartedNotification
import eventDemo.business.notification.WelcomeToTheGameNotification
import eventDemo.configuration.business.configureGameListener
import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory
import eventDemo.testKoinApplicationWithConfig
import io.kotest.assertions.nondeterministic.until
@@ -177,7 +177,7 @@ class GameSimulationTest :
val commandHandler by inject<GameCommandHandler>()
val eventStore by inject<GameEventStore>()
val playerNotificationListener by inject<PlayerNotificationListener>()
ReactionListener(get(), get()).init()
configureGameListener()
playerNotificationListener.startListening(player1, gameId) { channelNotification1.trySendBlocking(it) }
playerNotificationListener.startListening(player2, gameId) { channelNotification2.trySendBlocking(it) }