From fe9da2e0af3d447a4efa1e3d81d4b1e61ad56000 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 10 Oct 2026 06:52:06 +0200 Subject: [PATCH] Test AStoreRefusesAMissingCatalog (red: AetheriaStores.Open does not yet refuse) Builds; the new test fails against the current Open. Co-Authored-By: Claude Opus 5.5 --- .../Aetheria.Shared.Tests/AetheriaStoresTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Aetheria.Shared.Tests/AetheriaStoresTests.cs b/tests/Aetheria.Shared.Tests/AetheriaStoresTests.cs index e0fec193d..5b9cdacf2 100644 --- a/tests/Aetheria.Shared.Tests/AetheriaStoresTests.cs +++ b/tests/Aetheria.Shared.Tests/AetheriaStoresTests.cs @@ -200,6 +200,22 @@ public sealed class AetheriaStoresTests : IDisposable Assert.Null(record); } + // A shipped player with no catalog must not boot into an empty game: a read-only open of a missing path throws + // naming the path, and does not create the file. A writable open still seeds an empty catalog. + [Fact] + public void AStoreRefusesAMissingCatalog() + { + var missing = Path.Combine(_root, "absent", "Aetheria.cc"); + + var error = Assert.Throws(() => AetheriaStores.Open(missing)); + Assert.Contains(missing, error.Message); + Assert.False(File.Exists(missing)); + Assert.False(Directory.Exists(Path.GetDirectoryName(missing))); + + using (var seeded = AetheriaStores.Open(missing, catalogWritable: true)) + Assert.Empty(seeded.GetAll()); + } + private static string Hash(string path) => Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(path))); private static string[] SchemaNames(string path)