diff --git a/tests/ClaudeDo.Ui.Tests/ViewModels/UsagePillViewModelTests.cs b/tests/ClaudeDo.Ui.Tests/ViewModels/UsagePillViewModelTests.cs index 472849cc..e5bffe5e 100644 --- a/tests/ClaudeDo.Ui.Tests/ViewModels/UsagePillViewModelTests.cs +++ b/tests/ClaudeDo.Ui.Tests/ViewModels/UsagePillViewModelTests.cs @@ -1,4 +1,7 @@ using System; +using System.IO; +using ClaudeDo.Localization; +using ClaudeDo.Ui.Localization; using ClaudeDo.Ui.Services; using ClaudeDo.Ui.ViewModels; using Xunit; @@ -7,6 +10,18 @@ namespace ClaudeDo.Ui.Tests.ViewModels; public class UsagePillViewModelTests { + // Loc.Current is ambient static state defaulting to a key-echo localizer, so these + // assertions on real strings must install a real one instead of relying on whichever + // other test class happened to run first. + public UsagePillViewModelTests() + { + var dir = AppContext.BaseDirectory; + while (dir is not null && !Directory.Exists(Path.Combine(dir, "src", "ClaudeDo.Localization", "locales"))) + dir = Path.GetDirectoryName(dir); + Loc.Current = new Localizer( + LocaleStore.Load(Path.Combine(dir!, "src", "ClaudeDo.Localization", "locales")), "en"); + } + private sealed class FakeWorker : StubWorkerClient { public UsageSnapshotDto? InitialSnapshot;