Skip to content

Commit

Permalink
test: remove unnecessary default branch property
Browse files Browse the repository at this point in the history
  • Loading branch information
hielfx committed May 13, 2024
1 parent fd9c2c4 commit b95513a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions internal/use_cases/create_pull_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

type CreatePullRequestExecutionTestSuite struct {
suite.Suite
defaultBranchName string
uc use_cases.CreatePullRequest
gitProvider *domainFakes.FakeGitProvider
issueTrackerProvider *domainFakes.FakeIssueTrackerProvider
Expand All @@ -28,6 +27,10 @@ type CreatePullRequestExecutionTestSuite struct {
repositoryProvider *domainFakes.FakeRepositoryProvider
}

func (s *CreatePullRequestExecutionTestSuite) setGetBranchName(branchName string) {
s.branchProvider.EXPECT().GetBranchName(mock.Anything, mock.Anything, mock.Anything).Return(branchName, nil).Once()
}

type CreateGithubPullRequestExecutionTestSuite struct {
CreatePullRequestExecutionTestSuite
}
Expand All @@ -36,10 +39,6 @@ func TestCreateGitHubPullRequestExecutionTestSuite(t *testing.T) {
suite.Run(t, new(CreateGithubPullRequestExecutionTestSuite))
}

func (s *CreateGithubPullRequestExecutionTestSuite) SetupSuite() {
s.defaultBranchName = "feature/GH-1-sample-issue"
}

func (s *CreateGithubPullRequestExecutionTestSuite) SetupSubTest() {
s.gitProvider = domainFakes.NewFakeGitProvider()
s.userInteractionProvider = s.initializeUserInteractionProvider()
Expand Down Expand Up @@ -158,7 +157,7 @@ func (s *CreateGithubPullRequestExecutionTestSuite) TestCreatePullRequestExecuti

err := s.uc.Execute()

s.ErrorContains(err, use_cases.ErrRemoteBranchAlreadyExists(s.defaultBranchName).Error())
s.ErrorContains(err, use_cases.ErrRemoteBranchAlreadyExists(branchName).Error())
s.assertCreatePullRequestNotCalled()
})

Expand Down Expand Up @@ -380,10 +379,6 @@ func TestCreateJiraPullRequestExecutionTestSuite(t *testing.T) {
suite.Run(t, new(CreateJiraPullRequestExecutionTestSuite))
}

func (s *CreateJiraPullRequestExecutionTestSuite) SetupSuite() {
s.defaultBranchName = "feature/PROJECTKEY-1-sample-issue"
}

func (s *CreateJiraPullRequestExecutionTestSuite) SetupTest() {
s.getConfigFile = config.GetConfigFile
dir, _ := os.Getwd()
Expand Down Expand Up @@ -515,7 +510,7 @@ func (s *CreateJiraPullRequestExecutionTestSuite) TestCreatePullRequestExecution

err := s.uc.Execute()

s.ErrorContains(err, use_cases.ErrRemoteBranchAlreadyExists(s.defaultBranchName).Error())
s.ErrorContains(err, use_cases.ErrRemoteBranchAlreadyExists(branchName).Error())
s.assertCreatePullRequestNotCalled()
})

Expand Down

0 comments on commit b95513a

Please sign in to comment.