test(battle-node): wire-shape test + refresh stale comment for v1.1

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.
This commit is contained in:
gamer147
2026-06-01 15:20:48 -04:00
parent ff8e4abea8
commit 5021217134
2 changed files with 16 additions and 3 deletions

View File

@@ -99,9 +99,10 @@ public static class ScriptedLifecycle
Spin: ScriptedProfiles.ReadySpin));
/// <summary>
/// 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
/// <see cref="BuildOpponentTurnEnd"/>, which immediately follows and hands control
/// back to the player.
/// </summary>
public static MsgEnvelope BuildOpponentTurnStart() =>
EnvelopeForPush(NetworkBattleUri.TurnStart,

View File

@@ -158,6 +158,18 @@ public class TypedBodyWireShapeTests
Assert.That(node["uri"]!.GetValue<string>(), 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<int>(), Is.EqualTo(0));
Assert.That(node["resultCode"]!.GetValue<int>(), Is.EqualTo(1));
Assert.That(node["uri"]!.GetValue<string>(), Is.EqualTo("TurnEnd"));
}
/// <summary>
/// Wire-shape fixture: 30 copies of the legacy DummyCardId (100_011_010L) so the
/// existing literal assertions on <c>selfDeck[0].cardId</c> (line 81 above) keep working