Add cash game session setup and reload

This commit is contained in:
Jay
2026-07-26 14:55:15 -04:00
parent 14c35f18a3
commit 3aa55dd2ce
7 changed files with 302 additions and 25 deletions
@@ -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"))
}
}