Skip to content

Commit 4f622c9

Browse files
CopilotJoannaaKL
andcommitted
simplify matchPath and document delete endpoint
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
1 parent 65ff757 commit 4f622c9

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

pkg/github/testmock/testmock.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func matchPath(pattern, path string) bool {
139139
return trimmedPath == ""
140140
}
141141

142-
if pattern == path {
142+
if trimmedPattern == trimmedPath {
143143
return true
144144
}
145145

@@ -183,12 +183,13 @@ var (
183183
GetReposActionsWorkflowsRunsByOwnerByRepoByWorkflowID = EndpointPattern{Pattern: "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", Method: http.MethodGet}
184184
PostReposActionsWorkflowsDispatchesByOwnerByRepoByWorkflowID = EndpointPattern{Pattern: "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", Method: http.MethodPost}
185185

186-
GetReposIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}", Method: http.MethodGet}
187-
GetReposIssuesCommentsByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/comments", Method: http.MethodGet}
188-
GetReposIssuesSubIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues", Method: http.MethodGet}
189-
PostReposIssuesByOwnerByRepo = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues", Method: http.MethodPost}
190-
PostReposIssuesCommentsByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/comments", Method: http.MethodPost}
191-
PostReposIssuesSubIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues", Method: http.MethodPost}
186+
GetReposIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}", Method: http.MethodGet}
187+
GetReposIssuesCommentsByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/comments", Method: http.MethodGet}
188+
GetReposIssuesSubIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues", Method: http.MethodGet}
189+
PostReposIssuesByOwnerByRepo = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues", Method: http.MethodPost}
190+
PostReposIssuesCommentsByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/comments", Method: http.MethodPost}
191+
PostReposIssuesSubIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues", Method: http.MethodPost}
192+
// Note: GitHub's delete endpoint uses the singular form `/sub_issue`.
192193
DeleteReposIssuesSubIssueByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issue", Method: http.MethodDelete}
193194
PatchReposIssuesByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}", Method: http.MethodPatch}
194195
PatchReposIssuesSubIssuesPriorityByOwnerByRepoByIssueNumber = EndpointPattern{Pattern: "/repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority", Method: http.MethodPatch}

0 commit comments

Comments
 (0)