chore: fix various tests

This commit is contained in:
Julian Tölle 2024-08-02 19:06:32 +02:00
parent 3b6aca0f9b
commit 5e52f82a28
3 changed files with 7 additions and 13 deletions

View file

@ -21,7 +21,6 @@ func TestUpdateChangelogFile(t *testing.T) {
repoFn testutils.Repo repoFn testutils.Repo
entry string entry string
expectedContent string expectedContent string
newFile bool
wantErr assert.ErrorAssertionFunc wantErr assert.ErrorAssertionFunc
}{ }{
{ {
@ -29,7 +28,6 @@ func TestUpdateChangelogFile(t *testing.T) {
repoFn: testutils.WithTestRepo(), repoFn: testutils.WithTestRepo(),
entry: "## v1.0.0\n", entry: "## v1.0.0\n",
expectedContent: "# Changelog\n\n## v1.0.0\n", expectedContent: "# Changelog\n\n## v1.0.0\n",
newFile: true,
wantErr: assert.NoError, wantErr: assert.NoError,
}, },
{ {
@ -81,13 +79,8 @@ func TestUpdateChangelogFile(t *testing.T) {
changelogFileStatus := wtStatus.File(ChangelogFile) changelogFileStatus := wtStatus.File(ChangelogFile)
if tt.newFile { assert.Equal(t, git.Unmodified, changelogFileStatus.Worktree, "unexpected file status in worktree")
assert.Equal(t, git.Unmodified, changelogFileStatus.Worktree, "unexpected file status in worktree") assert.Equal(t, git.Added, changelogFileStatus.Staging, "unexpected file status in staging")
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")
}
changelogFile, err := wt.Filesystem.Open(ChangelogFile) changelogFile, err := wt.Filesystem.Open(ChangelogFile)
require.NoError(t, err) require.NoError(t, err)

View file

@ -123,7 +123,7 @@ func reconcileReleasePR(ctx context.Context, forge rp.Forge, changesets []rp.Cha
} }
if pr != nil { 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 var releaseOverrides rp.ReleaseOverrides

View file

@ -110,9 +110,10 @@ func TestAnalyzeCommits(t *testing.T) {
Description: "blabla", Description: "blabla",
}, },
{ {
Commit: Commit{Message: "feat!: foobar"}, Commit: Commit{Message: "feat!: foobar"},
Type: "feat", Type: "feat",
Description: "foobar", Description: "foobar",
BreakingChange: true,
}, },
}, },
expectedBump: conventionalcommits.MajorVersion, expectedBump: conventionalcommits.MajorVersion,