From cdee1a27f82866c73e0bdd36417c5d8c58ceb760 Mon Sep 17 00:00:00 2001 From: soul Date: Fri, 23 Oct 2026 03:43:55 +0200 Subject: [PATCH] LoadoutTests: a commit over a loadout written after the read writes nothing (kills the dropped-Expect mutant) Co-Authored-By: Claude Sonnet 5.5 --- tests/Aetheria.Shared.Tests/LoadoutTests.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Aetheria.Shared.Tests/LoadoutTests.cs b/tests/Aetheria.Shared.Tests/LoadoutTests.cs index 6f55baa76..fca4ba339 100644 --- a/tests/Aetheria.Shared.Tests/LoadoutTests.cs +++ b/tests/Aetheria.Shared.Tests/LoadoutTests.cs @@ -196,6 +196,26 @@ public sealed class LoadoutTests : IDisposable Assert.False(faction.BossLoadout.IsSet()); } + // The commit is conditional on the record at KeyOf(Name) too: a loadout written under that name after this cache read the + // catalog is not overwritten, even with replace set, and the second commit reports false. + [Fact] + public void ACommitOverALoadoutWrittenAfterTheReadWritesNothing() + { + Loadout loadout; + using (var read = Open()) + loadout = HandBuilt(read); + + using (var stale = AetheriaStores.Open(Catalog, catalogWritable: true)) + { + Assert.Empty(stale.GetAll()); + Assert.True(Loadouts.Commit(Catalog, loadout, replace: false)); + Assert.False(Loadouts.Commit(stale, loadout, replace: true, default)); + } + + using var after = Open(); + Assert.Single(after.GetAll()); + } + // A boss faction the catalog does not hold is refused before anything is written. [Fact] public void ABossCommitNamingNoFactionIsRefusedAndNothingIsWritten()