fix testApplicationWithConfig
This commit is contained in:
@@ -8,7 +8,6 @@ import eventDemo.business.event.projection.projectionListener.PlayerNotification
|
||||
import eventDemo.business.notification.CommandSuccessNotification
|
||||
import eventDemo.business.notification.Notification
|
||||
import eventDemo.business.notification.WelcomeToTheGameNotification
|
||||
import eventDemo.configuration.business.configureGameListener
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.collections.shouldContain
|
||||
@@ -26,11 +25,10 @@ import kotlin.time.Duration.Companion.seconds
|
||||
class GameCommandHandlerTest :
|
||||
FunSpec({
|
||||
test("handle a command should execute the command") {
|
||||
withTimeout(1.seconds) {
|
||||
withTimeout(5.seconds) {
|
||||
testKoinApplicationWithConfig {
|
||||
configureGameListener()
|
||||
val commandHandler by inject<GameCommandHandler>()
|
||||
val notificationListener by inject<PlayerNotificationListener>()
|
||||
val commandHandler = get<GameCommandHandler>()
|
||||
val notificationListener = get<PlayerNotificationListener>()
|
||||
val gameId = GameId()
|
||||
val player = Player("Tesla")
|
||||
val channelCommand = Channel<GameCommand>(Channel.BUFFERED)
|
||||
|
||||
@@ -6,7 +6,7 @@ import eventDemo.business.event.GameEventHandler
|
||||
import eventDemo.business.event.event.NewPlayerEvent
|
||||
import eventDemo.business.event.projection.gameState.GameState
|
||||
import eventDemo.business.event.projection.gameState.GameStateRepository
|
||||
import eventDemo.testApplicationWithConfig
|
||||
import eventDemo.testKoinApplicationWithConfig
|
||||
import io.kotest.assertions.nondeterministic.eventually
|
||||
import io.kotest.assertions.nondeterministic.eventuallyConfig
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
@@ -29,9 +29,9 @@ class GameStateRepositoryTest :
|
||||
|
||||
test("GameStateRepository should build the projection when a new event occurs") {
|
||||
val aggregateId = GameId()
|
||||
testApplicationWithConfig { koin ->
|
||||
val repo = koin.get<GameStateRepository>()
|
||||
val eventHandler = koin.get<GameEventHandler>()
|
||||
testKoinApplicationWithConfig {
|
||||
val repo = get<GameStateRepository>()
|
||||
val eventHandler = get<GameEventHandler>()
|
||||
eventHandler
|
||||
.handle(aggregateId) { NewPlayerEvent(aggregateId = aggregateId, player = player1, version = it) }
|
||||
.also { event ->
|
||||
@@ -50,10 +50,10 @@ class GameStateRepositoryTest :
|
||||
|
||||
test("get should build the last version of the state") {
|
||||
val aggregateId = GameId()
|
||||
testApplicationWithConfig { koin ->
|
||||
val repo = koin.get<GameStateRepository>()
|
||||
val eventHandler = koin.get<GameEventHandler>()
|
||||
val projectionBus = koin.get<GameProjectionBus>()
|
||||
testKoinApplicationWithConfig {
|
||||
val repo = get<GameStateRepository>()
|
||||
val eventHandler = get<GameEventHandler>()
|
||||
val projectionBus = get<GameProjectionBus>()
|
||||
|
||||
var state: GameState? = null
|
||||
projectionBus.subscribe {
|
||||
@@ -86,9 +86,9 @@ class GameStateRepositoryTest :
|
||||
test("getUntil should build the state until the event") {
|
||||
repeat(10) {
|
||||
val aggregateId = GameId()
|
||||
testApplicationWithConfig { koin ->
|
||||
val repo = koin.get<GameStateRepository>()
|
||||
val eventHandler = koin.get<GameEventHandler>()
|
||||
testKoinApplicationWithConfig {
|
||||
val repo = get<GameStateRepository>()
|
||||
val eventHandler = get<GameEventHandler>()
|
||||
|
||||
val event1 =
|
||||
eventHandler
|
||||
@@ -115,9 +115,9 @@ class GameStateRepositoryTest :
|
||||
|
||||
test("getUntil should be concurrently secure") {
|
||||
val aggregateId = GameId()
|
||||
testApplicationWithConfig { koin ->
|
||||
val repo = koin.get<GameStateRepository>()
|
||||
val eventHandler = koin.get<GameEventHandler>()
|
||||
testKoinApplicationWithConfig {
|
||||
val repo = get<GameStateRepository>()
|
||||
val eventHandler = get<GameEventHandler>()
|
||||
|
||||
(1..10)
|
||||
.map { r ->
|
||||
|
||||
Reference in New Issue
Block a user