test(battle-node): TurnEnd dispatch tests expect three-frame burst (TDD red)

Both single-cycle and consecutive-cycles tests now assert the v1.2
three-frame burst (TurnStart + TurnEnd + Judge). Currently failing —
ComputeResponses still pushes only two frames. Implementation follows.
This commit is contained in:
gamer147
2026-06-01 17:34:59 -04:00
parent 8a5b8b747d
commit 007513e55c

View File

@@ -99,7 +99,7 @@ public class BattleSessionDispatchTests
}
[Test]
public void TurnEnd_AfterReady_PushesOpponentTurnStart_ThenTurnEnd_StaysInAfterReady()
public void TurnEnd_AfterReady_PushesTurnStart_TurnEnd_Judge_StaysInAfterReady()
{
var s = NewSession();
s.ComputeResponses(NewEnvelope(NetworkBattleUri.InitNetwork));
@@ -109,14 +109,14 @@ public class BattleSessionDispatchTests
var responses = s.ComputeResponses(NewEnvelope(NetworkBattleUri.TurnEnd));
// Two-frame cycle: opponent opens its turn, immediately ends it, hands control back.
// Three-frame cycle: opponent opens its turn, ends it, sends Judge so the client's
// JudgeOperation -> ControlTurnStartPlayer fires and the player's next turn begins.
Assert.That(responses.Select(r => r.Envelope.Uri),
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd }));
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd, NetworkBattleUri.Judge }));
Assert.That(responses.Select(r => r.NoStock),
Is.EqualTo(new[] { false, false }));
// Phase returns to AfterReady within the same call; the next player TurnEnd can fire
// the cycle again. (OpponentTurn is set transiently inside ComputeResponses to document
// intent, but is never externally observable.)
Is.EqualTo(new[] { false, false, false }));
// Phase returns to AfterReady within the same call so the next player TurnEnd can fire
// the cycle again. OpponentTurn is set transiently and is never externally observable.
Assert.That(s.Phase, Is.EqualTo(BattleSessionPhase.AfterReady));
}
@@ -132,11 +132,11 @@ public class BattleSessionDispatchTests
var first = s.ComputeResponses(NewEnvelope(NetworkBattleUri.TurnEnd));
var second = s.ComputeResponses(NewEnvelope(NetworkBattleUri.TurnEnd));
// Both calls produce the same two-frame burst.
// Both calls produce the same three-frame burst.
Assert.That(first.Select(r => r.Envelope.Uri),
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd }));
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd, NetworkBattleUri.Judge }));
Assert.That(second.Select(r => r.Envelope.Uri),
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd }));
Is.EqualTo(new[] { NetworkBattleUri.TurnStart, NetworkBattleUri.TurnEnd, NetworkBattleUri.Judge }));
Assert.That(s.Phase, Is.EqualTo(BattleSessionPhase.AfterReady));
}