mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
ec2db4a727
<!-- Hi, thanks for contributing! Please make sure you read our CONTRIBUTING guide. Also, add tests and the respective documentation changes as well. --> <!-- If applied, this commit will... --> ... <!-- Why is this change being made? --> ... <!-- # Provide links to any relevant tickets, URLs or other resources --> ... --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package client
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/v2/pkg/config"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetReleaseNotes(t *testing.T) {
|
|
const existing = "existing rel notes"
|
|
const current = "current rel notes"
|
|
|
|
t.Run("keep and existing empty", func(t *testing.T) {
|
|
require.Equal(t, current, getReleaseNotes("", current, config.ReleaseNotesModeKeepExisting))
|
|
})
|
|
|
|
t.Run("keep", func(t *testing.T) {
|
|
require.Equal(t, existing, getReleaseNotes(existing, current, config.ReleaseNotesModeKeepExisting))
|
|
})
|
|
|
|
t.Run("replace", func(t *testing.T) {
|
|
require.Equal(t, current, getReleaseNotes(existing, current, config.ReleaseNotesModeReplace))
|
|
})
|
|
|
|
t.Run("append", func(t *testing.T) {
|
|
require.Equal(t, "existing rel notes\n\ncurrent rel notes", getReleaseNotes(existing, current, config.ReleaseNotesModeAppend))
|
|
})
|
|
|
|
t.Run("prepend", func(t *testing.T) {
|
|
require.Equal(t, "current rel notes\n\nexisting rel notes", getReleaseNotes(existing, current, config.ReleaseNotesModePrepend))
|
|
})
|
|
|
|
t.Run("invalid", func(t *testing.T) {
|
|
require.Equal(t, existing, getReleaseNotes(existing, current, config.ReleaseNotesMode("invalid")))
|
|
})
|
|
}
|