diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-26 20:50:25 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-27 10:59:39 +0100 |
commit | e600544531764f67a5917483526d8d1941454640 (patch) | |
tree | 186f23e11b4300cdc53393ff7891592280bbc961 /sw-server/src/test/kotlin/org/luxons | |
parent | Use plain redux compose when devtools not present (diff) | |
download | seven-wonders-e600544531764f67a5917483526d8d1941454640.tar.gz seven-wonders-e600544531764f67a5917483526d8d1941454640.tar.bz2 seven-wonders-e600544531764f67a5917483526d8d1941454640.zip |
Rework sagas and router to sub/unsubscribe properly
Diffstat (limited to 'sw-server/src/test/kotlin/org/luxons')
-rw-r--r-- | sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt index ab947609..e436d054 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server +import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeoutOrNull @@ -67,10 +68,10 @@ class SevenWondersTest { session2.joinGame(lobby.id) val outsiderSession = newPlayer("Outsider") - val started = outsiderSession.watchGameStart(lobby.id).messages + val started = launch { outsiderSession.awaitGameStart(lobby.id) } ownerSession.startGame() - val nothing = withTimeoutOrNull(30) { started.receive() } + val nothing = withTimeoutOrNull(30) { started.join() } assertNull(nothing) disconnect(ownerSession, session1, session2, outsiderSession) } @@ -126,14 +127,14 @@ class SevenWondersTest { val session3 = newPlayer("Player3") session3.joinGame(lobby.id) - val gameStart1 = session1.watchGameStart(lobby.id).messages - val gameStart2 = session2.watchGameStart(lobby.id).messages - val gameStart3 = session3.watchGameStart(lobby.id).messages + val gameStart1 = launch { session1.awaitGameStart(lobby.id) } + val gameStart2 = launch { session2.awaitGameStart(lobby.id) } + val gameStart3 = launch { session3.awaitGameStart(lobby.id) } session1.startGame() - withTimeout(500) { gameStart1.receive() } - withTimeout(500) { gameStart2.receive() } - withTimeout(500) { gameStart3.receive() } + withTimeout(500) { gameStart1.join() } + withTimeout(500) { gameStart2.join() } + withTimeout(500) { gameStart3.join() } val turns1 = session1.watchTurns().messages val turns2 = session2.watchTurns().messages |