From bf56cd8c75dd3de32c874a8e9e48f4510df8f9d5 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Mon, 24 Aug 2026 16:26:09 +0200 Subject: [PATCH] test(ui): teach the worker-client fakes about TokenTracker status --- tests/ClaudeDo.Ui.Tests/StubWorkerClient.cs | 11 +++++++++++ .../UiVm/TasksIslandViewModelPlanningTests.cs | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/ClaudeDo.Ui.Tests/StubWorkerClient.cs b/tests/ClaudeDo.Ui.Tests/StubWorkerClient.cs index 19ef5b77..6d6f5b1e 100644 --- a/tests/ClaudeDo.Ui.Tests/StubWorkerClient.cs +++ b/tests/ClaudeDo.Ui.Tests/StubWorkerClient.cs @@ -183,6 +183,17 @@ public abstract class StubWorkerClient : IWorkerClient => Task.FromResult>(Array.Empty()); public virtual Task> GetTaskUsageAsync(DateOnly from, DateOnly to) => Task.FromResult>(Array.Empty()); + + // "Not installed, but Node is fine" — the state that exercises the hint card and the + // install button without ever touching a real CLI. + public virtual Task GetTokenTrackerStatusAsync() => + Task.FromResult(new TokenTrackerStatusDto( + Installed: false, Version: null, NodeOk: true, NodeVersion: "v22.0.0", + LastFetchedUtc: null, LastError: null, FormatVersion: null, SessionCount: 0)); + + public virtual Task RefreshTokenTrackerAsync() => GetTokenTrackerStatusAsync(); + + public virtual Task InstallTokenTrackerAsync() => GetTokenTrackerStatusAsync(); public void RaiseUsageUpdated(UsageSnapshotDto snapshot) => UsageUpdatedEvent?.Invoke(snapshot); protected void RaisePropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); diff --git a/tests/ClaudeDo.Worker.Tests/UiVm/TasksIslandViewModelPlanningTests.cs b/tests/ClaudeDo.Worker.Tests/UiVm/TasksIslandViewModelPlanningTests.cs index 2b0d2878..7210719b 100644 --- a/tests/ClaudeDo.Worker.Tests/UiVm/TasksIslandViewModelPlanningTests.cs +++ b/tests/ClaudeDo.Worker.Tests/UiVm/TasksIslandViewModelPlanningTests.cs @@ -171,6 +171,15 @@ sealed class FakeWorkerClient : IWorkerClient => Task.FromResult>(System.Array.Empty()); public Task> GetTaskUsageAsync(DateOnly from, DateOnly to) => Task.FromResult>(System.Array.Empty()); + + public Task GetTokenTrackerStatusAsync() => + Task.FromResult(new TokenTrackerStatusDto( + Installed: false, Version: null, NodeOk: true, NodeVersion: "v22.0.0", + LastFetchedUtc: null, LastError: null, FormatVersion: null, SessionCount: 0)); + + public Task RefreshTokenTrackerAsync() => GetTokenTrackerStatusAsync(); + + public Task InstallTokenTrackerAsync() => GetTokenTrackerStatusAsync(); } // ── Helper to build VM with pre-seeded Items ──────────────────────────────────