From 5021217134763ab312dc57c09e108c18adbd5c94 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Mon, 1 Jun 2026 15:20:48 -0400 Subject: [PATCH] test(battle-node): wire-shape test + refresh stale comment for v1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final-review follow-ups: - BuildOpponentTurnStart's doc comment claimed the v1 client sits indefinitely — true before the loop closure, false after. Updated to describe the pair with BuildOpponentTurnEnd. - TypedBodyWireShapeTests had no coverage for BuildOpponentTurnEnd; added the literal-JSON test so a future JsonPropertyName rename on TurnEndBody is caught. --- SVSim.BattleNode/Lifecycle/ScriptedLifecycle.cs | 7 ++++--- .../BattleNode/Lifecycle/TypedBodyWireShapeTests.cs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/SVSim.BattleNode/Lifecycle/ScriptedLifecycle.cs b/SVSim.BattleNode/Lifecycle/ScriptedLifecycle.cs index d8ec94c..0b9e6d6 100644 --- a/SVSim.BattleNode/Lifecycle/ScriptedLifecycle.cs +++ b/SVSim.BattleNode/Lifecycle/ScriptedLifecycle.cs @@ -99,9 +99,10 @@ public static class ScriptedLifecycle Spin: ScriptedProfiles.ReadySpin)); /// - /// Generic TurnStart push used to transition the client into "Opponent's turn…" state - /// after the player's TurnEnd. v1 doesn't simulate the opponent — once this lands the - /// client sits at the opponent-turn display indefinitely. + /// First half of the v1.1 scripted opponent turn cycle: pushed after the player's + /// TurnEnd, transitions the client into "Opponent's turn…" state. Paired with + /// , which immediately follows and hands control + /// back to the player. /// public static MsgEnvelope BuildOpponentTurnStart() => EnvelopeForPush(NetworkBattleUri.TurnStart, diff --git a/SVSim.UnitTests/BattleNode/Lifecycle/TypedBodyWireShapeTests.cs b/SVSim.UnitTests/BattleNode/Lifecycle/TypedBodyWireShapeTests.cs index 73ef459..f35e54f 100644 --- a/SVSim.UnitTests/BattleNode/Lifecycle/TypedBodyWireShapeTests.cs +++ b/SVSim.UnitTests/BattleNode/Lifecycle/TypedBodyWireShapeTests.cs @@ -158,6 +158,18 @@ public class TypedBodyWireShapeTests Assert.That(node["uri"]!.GetValue(), Is.EqualTo("TurnStart")); } + [Test] + public void BuildOpponentTurnEnd_SerializesTurnStateAndResultCode() + { + var env = ScriptedLifecycle.BuildOpponentTurnEnd(); + var json = MsgEnvelope.ToJson(env); + var node = JsonNode.Parse(json)!.AsObject(); + + Assert.That(node["turnState"]!.GetValue(), Is.EqualTo(0)); + Assert.That(node["resultCode"]!.GetValue(), Is.EqualTo(1)); + Assert.That(node["uri"]!.GetValue(), Is.EqualTo("TurnEnd")); + } + /// /// Wire-shape fixture: 30 copies of the legacy DummyCardId (100_011_010L) so the /// existing literal assertions on selfDeck[0].cardId (line 81 above) keep working