Files
Chronos/tests/Titano.Tools.Tests/ChangelogCommandTests.cs
T
Claude 81f10379c8 fix(tools): say "Maintenance release." in titled notes without listed changes
The fallback tested the builder's length, which the title line already made
non-zero, so release.yml (always --title) published notes that were only a
heading when a release held chore, ci, test or refactor commits alone. The
fallback now depends on whether a section or breaking entry was written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 10:28:55 +00:00

34 lines
1.6 KiB
C#

using Titano.Testing;
using Titano.Tools.Commands;
namespace Titano.Tools.Tests;
/// <summary>Release notes from Conventional Commits (BRIEF §19.3), as release.yml renders them with a title.</summary>
public sealed class ChangelogCommandTests
{
[Test]
public void EntriesAreGroupedByTypeUnderTheTitle()
{
var notes = ChangelogCommand.Render(["abc1234\tfeat(editor): save the project as a .titano file", "def5678\tfix: keep user data", "0a1b2c3\tchore: bump"], "Titano 1.2.0");
Assert.Equal(
"# Titano 1.2.0\n\n### Added\n- **editor**: save the project as a .titano file (abc1234)\n\n### Fixed\n- keep user data (def5678)\n\n",
notes.ReplaceLineEndings("\n"));
}
[Test]
public void ATitledReleaseWithoutListedChangesSaysItIsAMaintenanceRelease()
{
string[] lines = ["abc1234\tchore: bump", "def5678\tci: cache", "0a1b2c3\ttest(setup): cover uninstall", "not a conventional subject"];
Assert.Equal("# Titano 1.2.1\n\nMaintenance release.\n", ChangelogCommand.Render(lines, "Titano 1.2.1").ReplaceLineEndings("\n"));
Assert.Equal("Maintenance release.\n", ChangelogCommand.Render(lines, null).ReplaceLineEndings("\n"));
Assert.Equal("Maintenance release.\n", ChangelogCommand.Render([], null).ReplaceLineEndings("\n"));
}
[Test]
public void ABreakingChangeOfAnUnlistedTypeIsStillWritten()
{
var notes = ChangelogCommand.Render(["abc1234\trefactor(core)!: rename the archive layout"], "Titano 2.0.0").ReplaceLineEndings("\n");
Assert.Equal("# Titano 2.0.0\n\n### Breaking changes\n- **core**: rename the archive layout (abc1234)\n\n", notes);
}
}