mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-08 02:37:04 +00:00
chore: fix changelog tests
This commit is contained in:
parent
c7743e0a80
commit
718364fe5c
2 changed files with 13 additions and 15 deletions
|
|
@ -13,4 +13,3 @@
|
||||||
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
|
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
`
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package rp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
|
|
@ -104,9 +103,9 @@ func TestUpdateChangelogFile(t *testing.T) {
|
||||||
|
|
||||||
func Test_NewChangelogEntry(t *testing.T) {
|
func Test_NewChangelogEntry(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
commits []AnalyzedCommit
|
changesets []Changeset
|
||||||
version string
|
version string
|
||||||
link string
|
link string
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
@ -117,9 +116,9 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "empty",
|
name: "empty",
|
||||||
args: args{
|
args: args{
|
||||||
commits: []AnalyzedCommit{},
|
changesets: []Changeset{{ChangelogEntries: []AnalyzedCommit{}}},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
},
|
},
|
||||||
want: "## [1.0.0](https://example.com/1.0.0)",
|
want: "## [1.0.0](https://example.com/1.0.0)",
|
||||||
wantErr: assert.NoError,
|
wantErr: assert.NoError,
|
||||||
|
|
@ -127,13 +126,13 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "single feature",
|
name: "single feature",
|
||||||
args: args{
|
args: args{
|
||||||
commits: []AnalyzedCommit{
|
changesets: []Changeset{{ChangelogEntries: []AnalyzedCommit{
|
||||||
{
|
{
|
||||||
Commit: Commit{},
|
Commit: Commit{},
|
||||||
Type: "feat",
|
Type: "feat",
|
||||||
Description: "Foobar!",
|
Description: "Foobar!",
|
||||||
},
|
},
|
||||||
},
|
}}},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
},
|
},
|
||||||
|
|
@ -143,13 +142,13 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "single fix",
|
name: "single fix",
|
||||||
args: args{
|
args: args{
|
||||||
commits: []AnalyzedCommit{
|
changesets: []Changeset{{ChangelogEntries: []AnalyzedCommit{
|
||||||
{
|
{
|
||||||
Commit: Commit{},
|
Commit: Commit{},
|
||||||
Type: "fix",
|
Type: "fix",
|
||||||
Description: "Foobar!",
|
Description: "Foobar!",
|
||||||
},
|
},
|
||||||
},
|
}}},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
},
|
},
|
||||||
|
|
@ -159,7 +158,7 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "multiple commits with scopes",
|
name: "multiple commits with scopes",
|
||||||
args: args{
|
args: args{
|
||||||
commits: []AnalyzedCommit{
|
changesets: []Changeset{{ChangelogEntries: []AnalyzedCommit{
|
||||||
{
|
{
|
||||||
Commit: Commit{},
|
Commit: Commit{},
|
||||||
Type: "feat",
|
Type: "feat",
|
||||||
|
|
@ -182,7 +181,7 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
Description: "So sad!",
|
Description: "So sad!",
|
||||||
Scope: ptr("sad"),
|
Scope: ptr("sad"),
|
||||||
},
|
},
|
||||||
},
|
}}},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
},
|
},
|
||||||
|
|
@ -203,7 +202,7 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
got, err := NewChangelogEntry(tt.args.commits, tt.args.version, tt.args.link)
|
got, err := NewChangelogEntry(tt.args.changesets, tt.args.version, tt.args.link)
|
||||||
if !tt.wantErr(t, err) {
|
if !tt.wantErr(t, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue