chore: fix changelog tests

This commit is contained in:
Julian Tölle 2024-08-02 17:29:54 +02:00
parent c7743e0a80
commit 718364fe5c
2 changed files with 13 additions and 15 deletions

View file

@ -13,4 +13,3 @@
- {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}} - {{ if .Scope }}**{{.Scope}}**: {{end}}{{.Description}}
{{ end -}} {{ end -}}
{{- end -}} {{- end -}}
`

View file

@ -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,7 +103,7 @@ 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
} }
@ -117,7 +116,7 @@ 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",
}, },
@ -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
} }