test(app): add headless ViewModel, CLI and localization tests

ViewModels run on Avalonia.Headless: wizard flows, password and file-lock
handling, seed and private-key reveal gating, contacts, settings, sync and
send against the fake server. The CLI entry point is invoked in-process
end to end. Localization checks cover the 7 languages, placeholders and
keys used in sources. Internal seams (UpdateCheck, ProfileOverride) keep
the tests offline.
This commit is contained in:
davide committed 2026-11-03 11:45:43 +01:00
1 parent 54d07f8e92
commit 530b7feaa5
11 files changed
+1023 -4

No files matched your search

+4
View File
@@ -27,4 +27,8 @@
<ItemGroup>
<ProjectReference Include="..\Core\PalladiumWallet.Core.csproj" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="PalladiumWallet.Tests" />
</ItemGroup>
</Project>
@@ -20,13 +20,17 @@ public partial class MainWindowViewModel
[RelayCommand]
private void CloseUpdateAvailable() => IsUpdateAvailableOpen = false;
/// <summary>Test seam: replaces the real GitHub check so tests never touch the network.</summary>
internal static System.Func<string, Task<LatestRelease?>> UpdateCheck { get; set; } =
version => UpdateChecker.CheckAsync(version);
/// <summary>
/// Fire-and-forget check run once at startup. Best-effort: any failure or an
/// up-to-date app silently does nothing (see <see cref="UpdateChecker"/>).
/// </summary>
private async Task CheckForUpdatesAsync()
{
var latest = await UpdateChecker.CheckAsync(AppVersion);
var latest = await UpdateCheck(AppVersion);
if (latest is null) return;
UpdateReleaseUrl = latest.HtmlUrl;
+4 -1
View File
@@ -130,7 +130,10 @@ public partial class MainWindowViewModel : ViewModelBase
// ---- helpers ----
private NetKind Net => NetKind.Mainnet;
private ChainProfile Profile => ChainProfiles.For(Net);
/// <summary>Test seam: lets tests drop the real bootstrap servers so nothing reaches the internet.</summary>
internal static ChainProfile? ProfileOverride { get; set; }
private ChainProfile Profile => ProfileOverride ?? ChainProfiles.For(Net);
private ServerRegistry Registry => new(Profile, AppPaths.ServersPath(Net));
private string Fmt(long sats, bool withLabel = true) =>