diff --git a/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs b/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs index acababe..83d9c40 100644 --- a/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs +++ b/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs @@ -220,21 +220,22 @@ public class BattleNodeFlowTests await DrivePvpHandshakeAsync(clientA, vidA, clientB, vidB, key, ct); - // Both are now AfterReady. A sends TurnEnd; both should receive TurnEnd + Judge. + // Both are now AfterReady. Deterministic-turn translator contract (per-URI, opponent- + // facing): the active player ends its turn by sending TurnEnd then Judge. The OPPONENT + // (B) receives the translated {turnState:0} TurnEnd and {spin:0} Judge; the sender (A) + // receives nothing back — it already ran the action locally. (Old behavior broadcast + // TurnEnd+Judge to both sides; that 4-route relay was replaced by the translator.) await clientA.SendMsgAsync(MakeEnvelopeWith(vidA, NetworkBattleUri.TurnEnd, pubSeq: 5), key, ct); + var bTurnEnd = await clientB.ReceiveSynchronizeAsync(ct); + Assert.That(bTurnEnd.Uri, Is.EqualTo(NetworkBattleUri.TurnEnd)); - var aFirst = await clientA.ReceiveSynchronizeAsync(ct); - var aSecond = await clientA.ReceiveSynchronizeAsync(ct); - var bFirst = await clientB.ReceiveSynchronizeAsync(ct); - var bSecond = await clientB.ReceiveSynchronizeAsync(ct); + await clientA.SendMsgAsync(MakeEnvelopeWith(vidA, NetworkBattleUri.Judge, pubSeq: 6), key, ct); + var bJudge = await clientB.ReceiveSynchronizeAsync(ct); + Assert.That(bJudge.Uri, Is.EqualTo(NetworkBattleUri.Judge)); - Assert.That(new[] { aFirst.Uri, aSecond.Uri }, - Is.EquivalentTo(new[] { NetworkBattleUri.TurnEnd, NetworkBattleUri.Judge })); - Assert.That(new[] { bFirst.Uri, bSecond.Uri }, - Is.EquivalentTo(new[] { NetworkBattleUri.TurnEnd, NetworkBattleUri.Judge })); - - // PlayActions forwarding: B sends, A receives. - await clientB.SendMsgAsync(MakeEnvelopeWith(vidB, NetworkBattleUri.PlayActions, pubSeq: 6), key, ct); + // PlayActions translation: B plays a card; A receives the opponent-facing PlayActions + // frame (Uri preserved, body synthesized by PlayActionsHandler). + await clientB.SendMsgAsync(MakeEnvelopeWith(vidB, NetworkBattleUri.PlayActions, pubSeq: 5), key, ct); var aForwarded = await clientA.ReceiveSynchronizeAsync(ct); Assert.That(aForwarded.Uri, Is.EqualTo(NetworkBattleUri.PlayActions)); }