From 833c47bbbaaead0e5dac6f4e70c84b78ee099e67 Mon Sep 17 00:00:00 2001 From: Danny Ranson Date: Fri, 17 May 2024 17:59:35 +0100 Subject: [PATCH] fixed test, still issue with pr body --- cmd/create_prs/create_prs.go | 1 - cmd/create_prs/create_prs_test.go | 5 ++++- internal/testsupport/testsupport.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/create_prs/create_prs.go b/cmd/create_prs/create_prs.go index 4048b17..8f155c9 100644 --- a/cmd/create_prs/create_prs.go +++ b/cmd/create_prs/create_prs.go @@ -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 - This PR was generated using [turbolift](https://github.com/Skyscanner/turbolift).` return dir.PrTitle == originalPrTitle || dir.PrBody == originalPrBody || dir.PrTitle == "" } diff --git a/cmd/create_prs/create_prs_test.go b/cmd/create_prs/create_prs_test.go index 7384413..1f4a511 100644 --- a/cmd/create_prs/create_prs_test.go +++ b/cmd/create_prs/create_prs_test.go @@ -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" ) @@ -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 @@ -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) diff --git a/internal/testsupport/testsupport.go b/internal/testsupport/testsupport.go index c2b7299..2c3ae36 100644 --- a/internal/testsupport/testsupport.go +++ b/internal/testsupport/testsupport.go @@ -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() {