test: run async UI test bodies to completion

Avalonia's Dispatch(Func<Task>) returns at the first real await, so the
assertions after it never ran and async ViewModel tests passed vacuously.
UiSession.Run now drives the body to completion while pumping the
dispatcher. The test profile has no checkpoints, since the fake chains use
tiny heights that the real mainnet checkpoints would try to anchor.
This commit is contained in:
davide committed 2026-11-03 15:11:06 +01:00
1 parent a08e972c4c
commit 24368a07b5
2 files changed
+21 -2

No files matched your search

@@ -34,7 +34,10 @@ public abstract class VmTestBase : IDisposable
MainWindowViewModel.UpdateCheck = _ => Task.FromResult<LatestRelease?>(null);
// No bootstrap servers: the only reachable server is the in-process fake, so the
// VM's connect/reconnect loops can never touch a real indexing server.
MainWindowViewModel.ProfileOverride = ChainProfiles.Mainnet with { BootstrapServers = [] };
// No checkpoints either: the fake chains use tiny heights, and with the real mainnet checkpoints
// every proof would have to be anchored up to height 20,000 (ADR 0040), which the fake
// server does not serve. Tests that care about anchoring set their own profile.
MainWindowViewModel.ProfileOverride = ChainProfiles.Mainnet with { BootstrapServers = [], Checkpoints = [] };
new AppConfig { LastServerHost = _server.Host, LastServerPort = _server.Port, LastServerUseSsl = false }
.Save(AppPaths.ConfigPath());
}