fix(ui-tests): install a real localizer in UsagePillViewModelTests
The pill tests asserted on real localized strings but never set Loc.Current, which defaults to a key-echo localizer. They only passed because an unrelated test class happened to install a real Localizer first; adding the usage-monitor modal tests changed the ordering and the assertions started seeing raw keys. Initialize Loc.Current in the constructor, matching every other UI test class.
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using ClaudeDo.Localization;
|
||||||
|
using ClaudeDo.Ui.Localization;
|
||||||
using ClaudeDo.Ui.Services;
|
using ClaudeDo.Ui.Services;
|
||||||
using ClaudeDo.Ui.ViewModels;
|
using ClaudeDo.Ui.ViewModels;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@@ -7,6 +10,18 @@ namespace ClaudeDo.Ui.Tests.ViewModels;
|
|||||||
|
|
||||||
public class UsagePillViewModelTests
|
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
|
private sealed class FakeWorker : StubWorkerClient
|
||||||
{
|
{
|
||||||
public UsageSnapshotDto? InitialSnapshot;
|
public UsageSnapshotDto? InitialSnapshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user