Skip to content

Commit

Permalink
fixed test, still issue with pr body
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Ranson committed May 17, 2024
1 parent 8bbdaac commit 833c47b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/create_prs/create_prs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ By approving this PR, you are confirming that you have adequately and effectivel
TODO: Describe the approach that was used to select repositories for this change
TODO: Describe any shell commands, scripts, manual operations, etc, that were used to make changes
<!-- Please keep the footer below, to support turbolift usage tracking -->
<sub>This PR was generated using [turbolift](https://github.com/Skyscanner/turbolift).</sub>`
return dir.PrTitle == originalPrTitle || dir.PrBody == originalPrBody || dir.PrTitle == ""
}
5 changes: 4 additions & 1 deletion cmd/create_prs/create_prs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/skyscanner/turbolift/internal/prompt"
"github.com/skyscanner/turbolift/internal/testsupport"
"github.com/stretchr/testify/assert"
"path/filepath"
"testing"
)

Expand All @@ -46,6 +47,7 @@ func TestItWarnsIfDescriptionFileTemplateIsUnchanged(t *testing.T) {
fakePrompt.AssertCalledWith(t, "It looks like the PR title and/or description has not been updated in README.md. Are you sure you want to proceed?")
}

// todo: why isn't this failing? it fails in manual testing
func TestItWarnsIfPrTitleIsUpdatedButNotPrBody(t *testing.T) {
fakeGitHub := github.NewAlwaysFailsFakeGitHub()
gh = fakeGitHub
Expand Down Expand Up @@ -76,7 +78,8 @@ func TestItWarnsIfPrBodyIsUpdatedButNotPrTitle(t *testing.T) {
p = fakePrompt

dir := testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2")
testsupport.UseDefaultPrTitleOnly(dir)
// dir is in the format /var/.../.../turbolift-test-XXXXXX
testsupport.UseDefaultPrTitleOnly(filepath.Base(dir))

out, err := runCommand()
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/testsupport/testsupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func UseDefaultPrDescription(dirName string) {
}

func UseDefaultPrTitleOnly(dirName string) {
CreateOrUpdatePrDescriptionFile("README.md", fmt.Sprintf("Title of Pull Request (%s)", dirName), "custom PR body")
CreateOrUpdatePrDescriptionFile("README.md", fmt.Sprintf("TODO: Title of Pull Request (%s)", dirName), "custom PR body")
}

func UseDefaultPrBodyOnly() {
Expand Down

0 comments on commit 833c47b

Please sign in to comment.