Skip to content

Commit

Permalink
chore: remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
hielfx committed May 29, 2024
1 parent 140b96c commit f6ea979
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 247 deletions.
117 changes: 0 additions & 117 deletions internal/issue_trackers/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,67 +165,6 @@ func Test_CheckConfiguration(t *testing.T) {
}
}

// func TestGetIssueType(t *testing.T) {

// createIssue := func(labelNames ...string) domain.Issue {
// labels := make([]domain.Label, len(labelNames))
// for i, labelName := range labelNames {
// labels[i] = domain.Label{Name: labelName}
// }
// return Issue{
// labels: labels,
// labelsConfig: config.GithubIssueLabels{
// issue_types.Bug: {"bug", "bugfix"},
// issue_types.Feature: {"feature", "enhancement"},
// issue_types.Refactoring: {},
// },
// }
// }

// for _, tc := range []struct {
// name string
// issue domain.Issue
// want issue_types.IssueType
// }{
// {
// name: "GetIssueType bug",
// issue: createIssue("bug"),
// want: issue_types.Bug,
// },
// {
// name: "GetIssueType bugfix",
// issue: createIssue("bugfix"),
// want: issue_types.Bug,
// },
// {
// name: "GetIssueType feature",
// issue: createIssue("feature"),
// want: issue_types.Feature,
// },
// {
// name: "GetIssueType enhancement",
// issue: createIssue("enhancement"),
// want: issue_types.Feature,
// },
// {
// name: "GetIssueType unknown refactoring",
// issue: createIssue("refactoring"),
// want: issue_types.Unknown,
// },
// {
// name: "GetIssueType unknown",
// issue: createIssue("unknown"),
// want: issue_types.Unknown,
// },
// } {
// tc := tc
// t.Run(tc.name, func(t *testing.T) {
// got := tc.issue.Type()
// assert.Equal(t, tc.want, got)
// })
// }
// }

func Test_IdentifyIssue(t *testing.T) {
type fields struct {
Cli domain.GhCli
Expand Down Expand Up @@ -277,59 +216,3 @@ func TestGithub_FormatIssueId(t *testing.T) {
})
}
}

// func TestGetIssueTypeLabel(t *testing.T) {

// createIssue := func(labelNames ...string) domain.Issue {
// labels := make([]domain.Label, len(labelNames))
// for i, labelName := range labelNames {
// labels[i] = domain.Label{Name: labelName}
// }
// return Issue{
// labels: labels,
// labelsConfig: config.GithubIssueLabels{
// issue_types.Bug: {"kind/bug", "kind/bugfix"},
// issue_types.Feature: {"kind/feat"},
// issue_types.Refactoring: {},
// },
// }
// }

// for _, tc := range []struct {
// name string
// issue domain.Issue
// want string
// }{
// {
// name: "Get issue type label with single mapped label",
// issue: createIssue("kind/feat"),
// want: "kind/feat",
// },
// {
// name: "Returns the same label in the issue if issue labels contains several mapped labels",
// issue: createIssue("kind/bugfix"),
// want: "kind/bugfix",
// },
// {
// name: "Get issue type label with multiple labels",
// issue: createIssue("not-a-label-kind", "kind/bugfix", "non-related-label"),
// want: "kind/bugfix",
// },
// {
// name: "Returns empty string if no label is present in the issue",
// issue: createIssue(),
// want: "",
// },
// {
// name: "Returns empty string if no kind label is present in the issue",
// issue: createIssue("not-a-label-kind", "non-related-label", "another-non-related-label"),
// want: "",
// },
// } {
// tc := tc
// t.Run(tc.name, func(t *testing.T) {
// got := tc.issue.TypeLabel()
// assert.Equal(t, tc.want, got)
// })
// }
// }
124 changes: 0 additions & 124 deletions internal/issue_trackers/jira/jira_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,127 +163,3 @@ func (s *JiraTestSuite) TestGetIssue() {
s.Equal(*s.expectedIssue, issue)
})
}

// func (s *JiraTestSuite) TestGojiraIssueToDomainIssue() {
// s.Run("Should convert a gojira issue to a domain issue", func() {
// issue := gojira.Issue{
// Key: "ISSUE-1",
// Fields: &gojira.IssueFields{
// Summary: "Summary",
// Description: "Description",
// Type: gojira.IssueType{
// ID: "1",
// Name: "Bug",
// Description: "Fixes a bug",
// },
// },
// }

// result := s.jira.goJiraIssueToIssue(issue)

// expected := Issue{
// id: "ISSUE-1",
// title: "Summary",
// body: "Description",
// jiraIssueType: JiraIssueType{
// Id: "1",
// Name: "Bug",
// Description: "Fixes a bug",
// },
// url: "https://jira.example.com/jira/browse/ISSUE-1",
// }

// s.Truef(reflect.DeepEqual(expected, result), "expected: %v, got: %v", expected, result)
// })
// }

// func TestGetIssueType(t *testing.T) {

// createIssue := func(issueTypeId string) domain.Issue {
// return Issue{
// issueType: JiraIssueType{
// Id: issueTypeId,
// },
// issueTypesConfig: config.JiraIssueTypes{
// issue_types.Bug: {"1"},
// issue_types.Feature: {"3", "5"},
// issue_types.Improvement: {},
// },
// }
// }

// for _, tc := range []struct {
// name string
// issue domain.Issue
// want issue_types.IssueType
// }{
// {
// name: "GetIssueType bug",
// issue: createIssue("1"),
// want: issue_types.Bug,
// },
// {
// name: "GetIssueType feature",
// issue: createIssue("3"),
// want: issue_types.Feature,
// },
// {
// name: "GetIssueType unknown",
// issue: createIssue("-1"),
// want: issue_types.Unknown,
// },
// } {
// tc := tc
// t.Run(tc.name, func(t *testing.T) {
// got := tc.issue.Type()
// assert.Equal(t, tc.want, got)
// })
// }
// }

// func TestGetIssueTypeLabel(t *testing.T) {
// createIssue := func(issueTypeId string) domain.Issue {
// return Issue{
// issueType: JiraIssueType{
// Id: issueTypeId,
// },
// issueTypesConfig: config.JiraIssueTypes{
// issue_types.Bug: {"1"},
// issue_types.Feature: {"3", "5"},
// issue_types.Improvement: {},
// },
// labelsConfig: map[issue_types.IssueType][]string{
// issue_types.Bug: {"kind/bug", "kind/bugfix"},
// issue_types.Feature: {"kind/feat"},
// },
// }
// }

// for _, tc := range []struct {
// name string
// issue domain.Issue
// want string
// }{
// {
// name: "Get issue type label with single mapped label",
// issue: createIssue("5"),
// want: "kind/feat",
// },
// {
// name: "Returns first issue label if multiple labels are mapped to the same issue type",
// issue: createIssue("1"),
// want: "kind/bug",
// },
// {
// name: "Returns empty string if no kind is present in the issue",
// issue: createIssue("-1"),
// want: "",
// },
// } {
// tc := tc
// t.Run(tc.name, func(t *testing.T) {
// got := tc.issue.TypeLabel()
// assert.Equal(t, tc.want, got)
// })
// }
// }
6 changes: 0 additions & 6 deletions internal/use_cases/create_pull_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,6 @@ func (s *CreateJiraPullRequestExecutionTestSuite) SetupSubTest() {
s.gitProvider.AddLocalBranches(s.defaultBranchName)
s.gitProvider.AddRemoteBranches(s.defaultBranchName)

// s.issueTracker = domainFakes.NewFakeIssueTracker()
// s.issueTracker.IssueTrackerType = domain.IssueTrackerTypeJira
// s.issueTracker.AddIssue("PROJECTKEY-1", issue_types.Feature)
// s.issueTracker.AddIssue("PROJECTKEY-3", issue_types.Documentation)
// s.issueTracker.AddIssue("PROJECTKEY-6", issue_types.Refactoring)

s.issueTrackerProvider = domainFakes.NewFakeIssueTrackerProvider()
issue1 := domainFakes.NewFakeIssue("PROJECTKEY-1", issue_types.Feature, domain.IssueTrackerTypeJira)
s.issueTrackerProvider.AddIssue(issue1)
Expand Down

0 comments on commit f6ea979

Please sign in to comment.