Re-runs the environment checks against the installed configuration (worker.config.json + detected install dir) without blocking navigation and without auto-running on window open, only on a "Recheck" click. Extracted the check-row rendering and check-run logic (busy state, summary, Recheck command) out of SystemCheckPage into a shared Checks/CheckListViewModel + Checks/CheckListView, composed by both SystemCheckPage (wizard) and the new DiagnosePage (settings) instead of duplicating it.
75 lines
2.6 KiB
C#
75 lines
2.6 KiB
C#
using ClaudeDo.Installer.Checks;
|
|
using ClaudeDo.Installer.Core;
|
|
using ClaudeDo.Installer.Pages.DiagnosePage;
|
|
using ClaudeDo.Installer.Pages.PathsPage;
|
|
using ClaudeDo.Installer.Pages.ServicePage;
|
|
using ClaudeDo.Installer.Pages.SystemCheckPage;
|
|
using ClaudeDo.Installer.Pages.UiSettingsPage;
|
|
using ClaudeDo.Installer.Pages.WelcomePage;
|
|
|
|
namespace ClaudeDo.Installer.Tests;
|
|
|
|
public class PageResolverTests
|
|
{
|
|
[Fact]
|
|
public void SystemCheckPage_is_in_the_wizard_directly_after_welcome()
|
|
{
|
|
var context = new InstallContext();
|
|
var pages = new IInstallerPage[]
|
|
{
|
|
new WelcomePageViewModel(context),
|
|
new SystemCheckPageViewModel(context, () => throw new InvalidOperationException()),
|
|
new PathsPageViewModel(context),
|
|
new ServicePageViewModel(context),
|
|
new UiSettingsPageViewModel(context),
|
|
};
|
|
|
|
var resolver = new PageResolver(pages);
|
|
var wizardPages = resolver.WizardPages;
|
|
|
|
var welcomeIndex = wizardPages.ToList().FindIndex(p => p is WelcomePageViewModel);
|
|
var systemCheckIndex = wizardPages.ToList().FindIndex(p => p is SystemCheckPageViewModel);
|
|
|
|
Assert.NotEqual(-1, welcomeIndex);
|
|
Assert.Equal(welcomeIndex + 1, systemCheckIndex);
|
|
}
|
|
|
|
[Fact]
|
|
public void SystemCheckPage_is_not_shown_in_settings()
|
|
{
|
|
var context = new InstallContext();
|
|
var page = new SystemCheckPageViewModel(context, () => throw new InvalidOperationException());
|
|
|
|
Assert.False(page.ShowInSettings);
|
|
}
|
|
|
|
[Fact]
|
|
public void DiagnosePage_is_shown_in_settings_but_not_in_the_wizard()
|
|
{
|
|
var context = new InstallContext();
|
|
var page = new DiagnosePageViewModel(context, () => throw new InvalidOperationException(), () => new InstallerWorkerConfig());
|
|
|
|
Assert.True(page.ShowInSettings);
|
|
Assert.False(page.ShowInWizard);
|
|
}
|
|
|
|
[Fact]
|
|
public void DiagnosePage_appears_in_the_settings_sidebar_after_the_other_settings_pages()
|
|
{
|
|
var context = new InstallContext();
|
|
var pages = new IInstallerPage[]
|
|
{
|
|
new PathsPageViewModel(context),
|
|
new ServicePageViewModel(context),
|
|
new UiSettingsPageViewModel(context),
|
|
new DiagnosePageViewModel(context, () => throw new InvalidOperationException(), () => new InstallerWorkerConfig()),
|
|
};
|
|
|
|
var resolver = new PageResolver(pages);
|
|
var settingsPages = resolver.SettingsPages.ToList();
|
|
|
|
Assert.Equal(4, settingsPages.Count);
|
|
Assert.IsType<DiagnosePageViewModel>(settingsPages[^1]);
|
|
}
|
|
}
|