fix(battlenode): EngineGlobalInit guarantees full-master postcondition (Phase 2 N2 review)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 16:29:04 -04:00
parent 5e0723c182
commit 6e8af4e68b
2 changed files with 24 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
using NUnit.Framework;
using SVSim.BattleNode.Sessions.Engine;
using System.Linq;
using SVSim.BattleEngine.Tests;
namespace SVSim.BattleEngine.Tests.SessionEngine;
@@ -15,6 +16,10 @@ public class SessionEngineSpellboostTests
var cl2 = CaptureReplay.Load("battle_test_cl2.ndjson");
var deckA = CaptureReplay.SelfDeckFrom(cl1);
var deckB = CaptureReplay.SelfDeckFrom(cl2);
// Belt-and-suspenders (matches the sibling tests): load the decks into the harness master so
// this test never depends on global card-master contents. EnsureInitialized() above still
// proves EngineGlobalInit's own path works.
foreach (var id in deckA.Concat(deckB).Distinct()) HeadlessCardMaster.Load((int)id);
var engine = new SessionBattleEngine();
Assert.DoesNotThrow(() => engine.Setup(masterSeed: 12345, seatADeck: deckA, seatBDeck: deckB));
Assert.That(engine.IsReady, Is.True, "engine must be ready after EngineGlobalInit (carried-risk fix)");