From 450e371f748edbd455b9ebbbee8f609ae5dea68e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 9 Oct 2026 02:14:54 +0200 Subject: [PATCH] Tests: the exponent pin reads the shipped designs through the catalog opener AetherDb.Open refuses a catalog without the test global record the scoped copies lack. Co-Authored-By: Claude Sonnet 5.5 --- .../RolesBackfillCommandTests.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/RolesBackfillCommandTests.cs b/tests/Aetheria.Shared.Tests/RolesBackfillCommandTests.cs index a34248df0..034ce7455 100644 --- a/tests/Aetheria.Shared.Tests/RolesBackfillCommandTests.cs +++ b/tests/Aetheria.Shared.Tests/RolesBackfillCommandTests.cs @@ -170,18 +170,17 @@ public sealed class RolesBackfillCommandTests : IDisposable .SelectMany(s => s.Stat.Terms.Where(t => t.Source == StatSource.Quality && !string.IsNullOrEmpty(t.Role)).Select(t => (s.Name, t.Exponent))) .ToDictionary(x => x.Name, x => x.Exponent); var designs = new[] { "Autocannon", "LRMM72" }; - Dictionary> Read(string root) - { - var db = AetherDb.Open(root: root); - try { return db.Cache.GetAll().Where(d => designs.Contains(d.Name)).ToDictionary(d => d.Name, Exponents); } - finally { db.Cache.Dispose(); } - } - var shipped = Read(AetherDb.FindRoot()); + Dictionary> shipped; + Dictionary> Read(EquippableItemData[] all) => all.Where(d => designs.Contains(d.Name)).ToDictionary(d => d.Name, Exponents); + using (var catalog = RestoredHullsTests.OpenCatalog()) shipped = Read(catalog.GetAll().ToArray()); Assert.All(designs, name => Assert.True(shipped[name].Values.Distinct().Count() > 1, name + " exponents are one value; the test would not tell a mode from a default")); Reset(flattened: true, unnamed: true); Assert.Equal(0, Program.RolesBackfill(apply: true, root: _root)); - var after = Read(_root); + var db = AetherDb.Open(root: _root); + Dictionary> after; + try { after = Read(db.Cache.GetAll().ToArray()); } + finally { db.Cache.Dispose(); } foreach (var name in designs) Assert.Equal(shipped[name].OrderBy(x => x.Key, StringComparer.Ordinal), after[name].OrderBy(x => x.Key, StringComparer.Ordinal)); }