summaryrefslogtreecommitdiff
path: root/sw-server/src/test
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-03 02:37:38 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-03 23:29:16 +0100
commit7c2371766b940742f3986d7904d4c20a4127ea70 (patch)
tree294d0c80b2590b69d032a37bcc78b3ce15be012a /sw-server/src/test
parentCleanup (diff)
downloadseven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.tar.gz
seven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.tar.bz2
seven-wonders-7c2371766b940742f3986d7904d4c20a4127ea70.zip
Add auto-game with bots only
Resolves: https://github.com/joffrey-bion/seven-wonders/issues/82
Diffstat (limited to 'sw-server/src/test')
-rw-r--r--sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt15
1 files changed, 7 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 02f43fcf..7c830140 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
@@ -9,6 +9,7 @@ import kotlinx.coroutines.withTimeoutOrNull
import org.junit.runner.RunWith
import org.luxons.sevenwonders.client.SevenWondersClient
import org.luxons.sevenwonders.client.SevenWondersSession
+import org.luxons.sevenwonders.client.createGameAndWaitLobby
import org.luxons.sevenwonders.client.joinGameAndWaitLobby
import org.luxons.sevenwonders.model.Action
import org.luxons.sevenwonders.model.api.GameListEvent
@@ -60,7 +61,7 @@ class SevenWondersTest {
val session2 = newPlayer("Player2")
val gameName = "Test Game"
- val lobby = ownerSession.createGameAndWaitLobby(gameName)
+ val lobby = ownerSession.createGameWithLegacySettingsAndWaitLobby(gameName)
session1.joinGameAndWaitLobby(lobby.id)
session2.joinGameAndWaitLobby(lobby.id)
@@ -80,7 +81,7 @@ class SevenWondersTest {
val ownerSession = newPlayer("GameOwner")
val gameName = "Test Game"
- val lobby = ownerSession.createGameAndWaitLobby(gameName)
+ val lobby = ownerSession.createGameWithLegacySettingsAndWaitLobby(gameName)
assertEquals(gameName, lobby.name)
disconnect(ownerSession)
@@ -97,7 +98,7 @@ class SevenWondersTest {
val ownerSession = newPlayer("GameOwner")
val gameName = "Test Game"
- val createdLobby = ownerSession.createGameAndWaitLobby(gameName)
+ val createdLobby = ownerSession.createGameWithLegacySettingsAndWaitLobby(gameName)
val afterGameListEvent = withTimeout(500) { games.receive() }
assertTrue(afterGameListEvent is GameListEvent.CreateOrUpdate)
@@ -114,7 +115,7 @@ class SevenWondersTest {
val session2 = newPlayer("Player2")
val startEvents1 = session1.watchGameStarted()
- val lobby = session1.createGameAndWaitLobby("Test Game")
+ val lobby = session1.createGameWithLegacySettingsAndWaitLobby("Test Game")
val startEvents2 = session2.watchGameStarted()
session2.joinGameAndWaitLobby(lobby.id)
@@ -146,10 +147,8 @@ class SevenWondersTest {
}
}
-private suspend fun SevenWondersSession.createGameAndWaitLobby(gameName: String): LobbyDTO {
- val joinedLobbies = watchLobbyJoined()
- createGame(gameName)
- val lobby = joinedLobbies.first()
+private suspend fun SevenWondersSession.createGameWithLegacySettingsAndWaitLobby(gameName: String): LobbyDTO {
+ val lobby = createGameAndWaitLobby(gameName)
updateSettings(lobby.settings.copy(askForReadiness = true))
return lobby
}
bgstack15