chore(go): add unreleased changelog tests

This commit is contained in:
Micheal Wilkinson
2026-03-21 14:25:19 +00:00
parent 64a7b6d86b
commit b7d1760beb
2 changed files with 32 additions and 0 deletions

View File

@@ -109,6 +109,25 @@ func (s *PrepareSuite) TestRecommendedTag_UsesMinorBumpWhenBreakingHeadingIsEmpt
require.Equal(s.T(), "v1.2.0", tag)
}
func (s *PrepareSuite) TestUnreleasedBody_ReturnsStructuredPendingReleaseNotes() {
body, err := vociferate.UnreleasedBody(s.rootDir, vociferate.Options{})
require.NoError(s.T(), err)
require.Equal(s.T(), "### Breaking\n\n### Added\n\n- New thing.\n\n### Fixed\n\n- Old thing.\n", body)
}
func (s *PrepareSuite) TestUnreleasedBody_ReturnsErrorWhenUnreleasedSectionMissing() {
require.NoError(s.T(), os.WriteFile(
filepath.Join(s.rootDir, "CHANGELOG.md"),
[]byte("# Changelog\n\n## [1.1.6] - 2017-12-20\n"),
0o644,
))
_, err := vociferate.UnreleasedBody(s.rootDir, vociferate.Options{})
require.ErrorContains(s.T(), err, "unreleased section")
}
func (s *PrepareSuite) TestRecommendedTag_ReturnsErrorWhenUnreleasedHasOnlyTemplateHeadings() {
require.NoError(s.T(), os.WriteFile(
filepath.Join(s.rootDir, "CHANGELOG.md"),