Files
ExecuteR/tests/Backend.Tests/AgentCatalogVersionTests.cs
Alphaeus Mote e969a57126 test: one version order everywhere, the installer's included
AgentVersions: the calendar era before 0.x and 1.x, 1.10 after 1.9, the
fourth field (missing = 0), +metadata, 0.0.0.0 and garbage first. The
installer's copy (compiled into Shared.Tests) answers exactly like it for
every pair, reads the calendar MSIs' yy.MM.minutes back and finds a newer
installed release by all four fields. KeepInstallerPackage keeps an MSI
under its hash with its name, once, the newest three and the one just
installed, and leaves other folders alone. agentVersion rules order by
version; the watchdog's version and the catalog's accepted versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:49:48 -04:00

25 lines
850 B
C#

using Backend.Upgrades;
using Xunit;
namespace Backend.Tests;
public sealed class AgentCatalogVersionTests
{
[Theory]
[InlineData("0.1.0", true)] // semantic versions start at 0.x
[InlineData("0.0.0.253", true)] // a build before the first release tag
[InlineData("1.4.0", true)]
[InlineData("1.4.0.7", true)]
[InlineData("2026.10.10.0140", true)] // the calendar era still catalogues
[InlineData("0.0.0.0", false)] // the development version
[InlineData("1.4.0+1a2b3c4", false)] // metadata never names a catalog version
[InlineData("1.4", false)]
[InlineData("1.4.0-rc.1", false)]
[InlineData(" 1.4.0", false)]
[InlineData(null, false)]
public void CatalogVersions(string? version, bool catalogued)
{
Assert.Equal(catalogued, AgentCatalogService.IsCatalogVersion(version));
}
}