feat(battle-node): client-shaped handshake builders for the scripted bot

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-03 10:49:38 -04:00
parent 633c29b44f
commit a533e9d89d
2 changed files with 52 additions and 0 deletions

View File

@@ -166,6 +166,27 @@ public class ScriptedLifecycleTests
"single-arg overload (non-interactive opponent) keeps the placeholder hand.");
}
[Test]
public void BuildClientSwap_has_empty_idxList_in_RawBody()
{
var env = ScriptedLifecycle.BuildClientSwap();
Assert.That(env.Uri, Is.EqualTo(NetworkBattleUri.Swap));
Assert.That(env.ViewerId, Is.EqualTo(ScriptedLifecycle.FakeOpponentViewerId));
var raw = (RawBody)env.Body;
Assert.That(raw.Entries.ContainsKey("idxList"), Is.True);
var idx = (System.Collections.IEnumerable)raw.Entries["idxList"]!;
Assert.That(idx.Cast<object>().Count(), Is.EqualTo(0), "bot keeps its dealt hand (empty mulligan).");
}
[Test]
public void BuildClientHandshakeFrames_carry_expected_uris()
{
Assert.That(ScriptedLifecycle.BuildClientInitNetwork().Uri, Is.EqualTo(NetworkBattleUri.InitNetwork));
Assert.That(ScriptedLifecycle.BuildClientInitBattle().Uri, Is.EqualTo(NetworkBattleUri.InitBattle));
Assert.That(ScriptedLifecycle.BuildClientLoaded().Uri, Is.EqualTo(NetworkBattleUri.Loaded));
}
[Test]
public void BuildOpponentTurnStart_HasUriTurnStartAndSpin()
{