test(installer): pin 'unparseable version = Config' behavior + document IsNewer limits

This commit is contained in:
Mika Kuns
2026-04-15 09:26:18 +02:00
parent 97fb215ce6
commit b4dc9509cb
2 changed files with 26 additions and 0 deletions

View File

@@ -102,4 +102,23 @@ public sealed class InstallModeDetectorTests : IDisposable
Assert.Equal(InstallerMode.Config, state.Mode);
}
[Fact]
public async Task Detect_Config_WhenInstalledVersion_IsUnparseable()
{
// install.json has been tampered with or written by an older installer with a
// version string we can't compare. Must not crash; must land on Config (no update).
InstallManifestStore.Write(_tempDir,
new InstallManifest("garbage", _tempDir, _tempDir, DateTimeOffset.UtcNow));
var fake = new FakeReleaseClient
{
Release = new GiteaRelease("v0.2.0", "v0.2.0", Array.Empty<ReleaseAsset>())
};
var detector = new InstallModeDetector(fake);
var state = await detector.DetectAsync(_tempDir, CancellationToken.None);
Assert.Equal(InstallerMode.Config, state.Mode);
}
}