chore(go): add unreleased changelog tests
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user