Files
ClaudeDo/tests/ClaudeDo.Installer.Tests/Pages/SystemCheckPage/FakeEnvironmentCheck.cs
T
mika kuns 5cc1ec98c0 feat(installer): add SystemCheckPage with blocking-error gating
Adds a new wizard page (positioned right after Welcome, FreshInstall only)
that auto-runs EnvironmentCheckService on entry and shows one row per check
with status icon, localized title/message, and hint+help-link on
failure/unknown. A "Recheck" button re-runs it, guarded against re-entrancy.

IInstallerPage gets a BlocksNavigation default member; WizardViewModel's
Next button now binds to CanGoNext, which the current page can veto (used
here while a check run is in flight or a blocking Error+Failed result is
present — Warnings and Unknown results never block). The summary line names
the blocking checks so a disabled Next is self-explanatory.

Wires up DI for the check pipeline (IProcessRunner, IPortOwnerResolver,
per-run ClaudeCliLookup) and adds the checks.* / installer.systemCheck.*
locale keys in en.json + de.json.

Visual appearance is NOT verified — needs a manual pass in the running
installer.
2026-08-05 20:09:52 +02:00

36 lines
1.4 KiB
C#

using ClaudeDo.Installer.Checks;
using ClaudeDo.Installer.Core;
namespace ClaudeDo.Installer.Tests.Pages.SystemCheckPage;
internal sealed class FakeEnvironmentCheck : IEnvironmentCheck
{
private readonly Func<InstallContext, CancellationToken, Task<CheckResult>> _run;
public FakeEnvironmentCheck(string id, CheckSeverity severity, Func<InstallContext, CancellationToken, Task<CheckResult>> run)
{
Id = id;
Severity = severity;
_run = run;
}
public static FakeEnvironmentCheck Ok(string id, CheckSeverity severity = CheckSeverity.Error) =>
new(id, severity, (_, _) => Task.FromResult(CheckResult.Ok(id, severity, $"checks.{id}.title", "ok")));
public static FakeEnvironmentCheck Fail(string id, CheckSeverity severity) =>
new(id, severity, (_, _) => Task.FromResult(CheckResult.Fail(id, severity, $"checks.{id}.title", "failed")));
public static FakeEnvironmentCheck Unknown(string id, CheckSeverity severity = CheckSeverity.Warning) =>
new(id, severity, (_, _) => Task.FromResult(CheckResult.Unknown(id, severity, $"checks.{id}.title", "unknown")));
public string Id { get; }
public CheckSeverity Severity { get; }
public int CallCount { get; private set; }
public Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
CallCount++;
return _run(ctx, ct);
}
}