Fixes assertion

This commit is contained in:
Vitor Pamplona
2026-03-31 08:59:38 -04:00
parent 9cb7f9cc21
commit 26798e2b57
2 changed files with 3 additions and 2 deletions
@@ -696,7 +696,7 @@ class ChessLobbyLogic(
// Check status FIRST to avoid briefly emitting a finished game through activeGames // Check status FIRST to avoid briefly emitting a finished game through activeGames
val gameStatus = result.liveState.gameStatus.value val gameStatus = result.liveState.gameStatus.value
if (gameStatus is GameStatus.Finished) { if (gameStatus is GameStatus.Finished) {
Log.d("chessdebug") { "[Lobby] refreshGame: game ${startEventId.take(8)} is FINISHED (${(gameStatus as GameStatus.Finished).result}), moving to completed" } Log.d("chessdebug") { "[Lobby] refreshGame: game ${startEventId.take(8)} is FINISHED (${gameStatus.result}), moving to completed" }
state.moveToCompleted(startEventId, gameStatus.result.notation, null) state.moveToCompleted(startEventId, gameStatus.result.notation, null)
pollingDelegate.removeGameId(startEventId) pollingDelegate.removeGameId(startEventId)
} else { } else {
@@ -24,6 +24,7 @@ import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertNotNull import kotlin.test.assertNotNull
import kotlin.test.assertNull import kotlin.test.assertNull
import kotlin.test.assertTrue
class BleChunkAssemblerTest { class BleChunkAssemblerTest {
@Test @Test
@@ -43,7 +44,7 @@ class BleChunkAssemblerTest {
val assembler = BleChunkAssembler() val assembler = BleChunkAssembler()
val message = """["EVENT",{"content":"hello world from nostr ble mesh networking"}]""" val message = """["EVENT",{"content":"hello world from nostr ble mesh networking"}]"""
val chunks = BleMessageChunker.splitIntoChunks(message, chunkSize = 10) val chunks = BleMessageChunker.splitIntoChunks(message, chunkSize = 10)
assert(chunks.size > 1) assertTrue(chunks.size > 1)
for (i in 0 until chunks.size - 1) { for (i in 0 until chunks.size - 1) {
val result = assembler.addChunk(chunks[i]) val result = assembler.addChunk(chunks[i])