Blocking findings: 1. A Codex RPC error or early exit threw past LimitProbe and stopped the refresh loop, so Claude stopped updating too (D2). Every probe failure is now a failed probe result, the loop records an unexpected tick failure and keeps ticking, shutdown cancellation still propagates, the app reports failed operations, and the CLI exits 1 instead of crashing. Fake app-server modes in the GUI process host test errors, EOF and garbage. 2. Totals converted local midnight directly and threw where midnight does not exist (Cairo, Santiago, Beirut). Today and the week start through CalendarDays now. 3. Daily chart labels used UTC dates for local-day buckets; labels and tooltips now share the local date. Review notes fixed as well: Claude Code installed with npm on Windows is found through its native binary or cli.js; the plugin ends cleanly on a bad host frame; Linux autostart honours XDG_CONFIG_HOME; the unused stub installer and the worker names in docs are gone. Refs #1
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
Hand-written fixtures only. xUnit v3 AOT with Microsoft.Testing.Platform.
|
||||
Run `dotnet test --project tests/FinalToken.App.Tests -c Release` from the root.
|
||||
View-model tests use public Core queries. Headless tests run on a dedicated UI thread with
|
||||
Skia and HarfBuzz, exercise settings and popup actions, and save seven PNG screenshots outside
|
||||
the repo at ../runs/shots/w2. FINALTOKEN_SCREENSHOT_DIR overrides that path.
|
||||
Skia and HarfBuzz, exercise settings and popup actions, and save PNG screenshots outside
|
||||
the repo at ../runs/shots/app. FINALTOKEN_SCREENSHOT_DIR overrides that path.
|
||||
Popup expiry uses an injected TimeProvider; fire timers and pump the dispatcher instead of sleeping.
|
||||
|
||||
@@ -5,6 +5,24 @@ namespace FinalToken.App.Tests;
|
||||
|
||||
public sealed class FormattingTests
|
||||
{
|
||||
[Fact]
|
||||
public void DailyChartLabelAndTooltipUseTheBucketsLocalDate()
|
||||
{
|
||||
var zone = TimeZoneInfo.CreateCustomTimeZone("Fixture+02", TimeSpan.FromHours(2), "Fixture", "Fixture");
|
||||
var day = FinalToken.Core.CalendarDays.Start(new DateTimeOffset(2026, 10, 14, 12, 0, 0, TimeSpan.Zero), zone);
|
||||
Assert.Equal("10-14", Display.ChartDateLabel(day, TimeSpan.FromDays(1)));
|
||||
Assert.Equal(day.DateTime.ToString("g"), Display.ChartTimestamp(day, TimeSpan.FromDays(1)));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData("custom-config")]
|
||||
public void LinuxAutostartHonorsConfigHome(string? configHome)
|
||||
{
|
||||
var home = Path.Combine(Path.GetTempPath(), "fixture-home");
|
||||
var config = string.IsNullOrEmpty(configHome) ? null : Path.Combine(Path.GetTempPath(), configHome);
|
||||
Assert.Equal(Path.Combine(config ?? Path.Combine(home, ".config"), "autostart", "finaltoken.desktop"), OsStartup.LinuxAutostartPath(config, home));
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("de-DE")]
|
||||
[InlineData("en-US")]
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class HeadlessTests
|
||||
AppBuilder.Configure<TestApplication>().UseSkia().UseHarfBuzz().UseHeadless(new() { UseHeadlessDrawing = false }).SetupWithoutStarting();
|
||||
var root = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (root.Parent is not null && !File.Exists(Path.Combine(root.FullName, "FinalToken.slnx"))) root = root.Parent;
|
||||
var shots = Environment.GetEnvironmentVariable("FINALTOKEN_SCREENSHOT_DIR") ?? Path.Combine(root.Parent!.FullName, "runs", "shots", "w2");
|
||||
var shots = Environment.GetEnvironmentVariable("FINALTOKEN_SCREENSHOT_DIR") ?? Path.Combine(root.Parent!.FullName, "runs", "shots", "app");
|
||||
Directory.CreateDirectory(shots);
|
||||
var model = FakeData.Model();
|
||||
var panel = new PanelWindow(model, () => { }, () => { }, () => { }, () => { }) { Height = 2450 };
|
||||
@@ -86,7 +86,7 @@ public sealed class HeadlessTests
|
||||
using (chartWindow.CaptureRenderedFrame()) { }
|
||||
chartWindow.MouseMove(new Point(65, 80));
|
||||
Assert.Contains(123456.ToString("N0"), ToolTip.GetTip(chart)?.ToString()); chartWindow.Close();
|
||||
var polishShots = Path.Combine(root.Parent!.FullName, "runs", "shots", "w1");
|
||||
var polishShots = shots;
|
||||
Directory.CreateDirectory(polishShots);
|
||||
var emptyChart = new Window { Content = Ui.Card(Ui.Stack(Ui.Text("Tokens per hour", 19), new UsageChart())), Width = 620, Height = 260,
|
||||
RequestedThemeVariant = ThemeVariant.Light };
|
||||
@@ -96,6 +96,13 @@ public sealed class HeadlessTests
|
||||
{ Values = [new(time, "Claude", 1), new(time.AddHours(1), "Claude", 2), new(time.AddHours(2), "Claude", 3)] })),
|
||||
Width = 620, Height = 260, RequestedThemeVariant = ThemeVariant.Light };
|
||||
smallChart.Show(); Save(smallChart, "chart-max-3.png", polishShots); smallChart.Close();
|
||||
var day = new DateTimeOffset(2026, 10, 14, 0, 0, 0, TimeSpan.FromHours(2));
|
||||
var daily = new UsageChart { Interval = TimeSpan.FromDays(1), Values = [new(day, "Claude", 3), new(day.AddDays(1), "Claude", 2)] };
|
||||
var dailyWindow = new Window { Content = Ui.Card(Ui.Stack(Ui.Text("Tokens per day", 19), daily)),
|
||||
Width = 620, Height = 260, RequestedThemeVariant = ThemeVariant.Light };
|
||||
dailyWindow.Show(); Save(dailyWindow, "chart-local-day.png");
|
||||
dailyWindow.MouseMove(new Point(90, 150));
|
||||
Assert.Contains(day.DateTime.ToString("g"), ToolTip.GetTip(daily)?.ToString()); dailyWindow.Close();
|
||||
popupClock.Fire(); Dispatcher.UIThread.RunJobs();
|
||||
Assert.False(first.IsVisible); Assert.False(second.IsVisible);
|
||||
Assert.All(popupClock.Timers, timer => Assert.True(timer.Disposed));
|
||||
|
||||
Reference in New Issue
Block a user