Add cash game session setup and reload
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.jsjdesigns.poker
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class CashGameSessionTest {
|
||||
|
||||
@Test
|
||||
fun `blank player name has an honest second-person fallback`() {
|
||||
assertEquals("You", cashGameConfig(" ").playerName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `player name is normalised once at the session boundary`() {
|
||||
assertEquals("Jay Smith", cashGameConfig(" Jay Smith ").playerName)
|
||||
assertEquals(
|
||||
MAX_PLAYER_NAME_LENGTH,
|
||||
cashGameConfig("A name much too long for a phone table").playerName.length,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `automatic top ups categorically exclude the human seat`() {
|
||||
val topUps = automaticTopUpSeatIndices(
|
||||
stacks = listOf(0, 0, 1, 2, 200),
|
||||
heroSeat = 0,
|
||||
bigBlind = 2,
|
||||
)
|
||||
|
||||
assertEquals(listOf(1, 2), topUps)
|
||||
assertFalse(HERO_SEAT in topUps)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `continuation copy promises the exact stack the reload produces`() {
|
||||
assertEquals(
|
||||
"Reload to 200 & deal",
|
||||
continuationButtonLabel(
|
||||
nextHandRequested = false,
|
||||
rebuyRequired = true,
|
||||
buyIn = 200,
|
||||
),
|
||||
)
|
||||
assertEquals("Next hand", continuationButtonLabel(false, false, 200))
|
||||
assertEquals("Dealing…", continuationButtonLabel(true, true, 200))
|
||||
assertTrue(continuationButtonLabel(false, true, 200).contains("200"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user