From 5e52f82a285f13a65d750fae915db8c53f8303d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Fri, 2 Aug 2024 19:06:32 +0200 Subject: [PATCH] chore: fix various tests --- changelog_test.go | 11 ++--------- cmd/rp/cmd/run.go | 2 +- commits_test.go | 7 ++++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/changelog_test.go b/changelog_test.go index 1376d7e..9751c17 100644 --- a/changelog_test.go +++ b/changelog_test.go @@ -21,7 +21,6 @@ func TestUpdateChangelogFile(t *testing.T) { repoFn testutils.Repo entry string expectedContent string - newFile bool wantErr assert.ErrorAssertionFunc }{ { @@ -29,7 +28,6 @@ func TestUpdateChangelogFile(t *testing.T) { repoFn: testutils.WithTestRepo(), entry: "## v1.0.0\n", expectedContent: "# Changelog\n\n## v1.0.0\n", - newFile: true, wantErr: assert.NoError, }, { @@ -81,13 +79,8 @@ func TestUpdateChangelogFile(t *testing.T) { changelogFileStatus := wtStatus.File(ChangelogFile) - if tt.newFile { - assert.Equal(t, git.Unmodified, changelogFileStatus.Worktree, "unexpected file status in worktree") - assert.Equal(t, git.Added, changelogFileStatus.Staging, "unexpected file status in staging") - } else { - assert.Equal(t, git.Modified, changelogFileStatus.Worktree, "unexpected file status in worktree") - assert.Equal(t, git.Modified, changelogFileStatus.Staging, "unexpected file status in staging") - } + assert.Equal(t, git.Unmodified, changelogFileStatus.Worktree, "unexpected file status in worktree") + assert.Equal(t, git.Added, changelogFileStatus.Staging, "unexpected file status in staging") changelogFile, err := wt.Filesystem.Open(ChangelogFile) require.NoError(t, err) diff --git a/cmd/rp/cmd/run.go b/cmd/rp/cmd/run.go index e8f7f6b..04e6aef 100644 --- a/cmd/rp/cmd/run.go +++ b/cmd/rp/cmd/run.go @@ -123,7 +123,7 @@ func reconcileReleasePR(ctx context.Context, forge rp.Forge, changesets []rp.Cha } if pr != nil { - logger.InfoContext(ctx, "found existing release pull request: %d: %s", pr.ID, pr.Title) + logger.InfoContext(ctx, "found existing release pull request", "pr.id", pr.ID, "pr.title", pr.Title) } var releaseOverrides rp.ReleaseOverrides diff --git a/commits_test.go b/commits_test.go index 15c8966..2321c7c 100644 --- a/commits_test.go +++ b/commits_test.go @@ -110,9 +110,10 @@ func TestAnalyzeCommits(t *testing.T) { Description: "blabla", }, { - Commit: Commit{Message: "feat!: foobar"}, - Type: "feat", - Description: "foobar", + Commit: Commit{Message: "feat!: foobar"}, + Type: "feat", + Description: "foobar", + BreakingChange: true, }, }, expectedBump: conventionalcommits.MajorVersion,