Skip to content

Commit 4d78776

Browse files
zwickCopilot
andcommitted
Restore explicit issue read query matcher
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e2c1a6e commit 4d78776

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

pkg/github/issues_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,16 @@ func newRepoAccessHTTPClient() *http.Client {
4949
return &http.Client{Transport: &repoAccessMockTransport{responses: responses}}
5050
}
5151

52+
const issueReadEnrichmentQueryString = "query($ids:[ID!]!){nodes(ids: $ids){... on Issue{id,issueFieldValues(first: 25){nodes{__typename,... on IssueFieldDateValue{field{... on IssueFieldDate{name,fullDatabaseId},... on IssueFieldNumber{name,fullDatabaseId},... on IssueFieldSingleSelect{name,fullDatabaseId},... on IssueFieldText{name,fullDatabaseId}},value},... on IssueFieldNumberValue{field{... on IssueFieldDate{name,fullDatabaseId},... on IssueFieldNumber{name,fullDatabaseId},... on IssueFieldSingleSelect{name,fullDatabaseId},... on IssueFieldText{name,fullDatabaseId}},valueNumber: value},... on IssueFieldSingleSelectValue{field{... on IssueFieldDate{name,fullDatabaseId},... on IssueFieldNumber{name,fullDatabaseId},... on IssueFieldSingleSelect{name,fullDatabaseId},... on IssueFieldText{name,fullDatabaseId}},value},... on IssueFieldTextValue{field{... on IssueFieldDate{name,fullDatabaseId},... on IssueFieldNumber{name,fullDatabaseId},... on IssueFieldSingleSelect{name,fullDatabaseId},... on IssueFieldText{name,fullDatabaseId}},value}}},parent{number,title,state,url,author{login},repository{nameWithOwner}},subIssuesSummary{total,completed,percentCompleted}}}}"
53+
5254
// newIssueReadEnrichmentMatcher builds a matcher for the issue_read `get` enrichment query for a
53-
// single issue node ID. The query string is constructed from the typed githubv4.ID variable so the
54-
// generated `$ids:[ID!]!` declaration matches the real client, while the comparison variables are
55-
// reassigned to the []any shape the request body decodes into so equality holds.
55+
// single issue node ID.
5656
func newIssueReadEnrichmentMatcher(nodeID string, response githubv4mock.GQLResponse) githubv4mock.Matcher {
57-
matcher := githubv4mock.NewQueryMatcher(
58-
issueReadEnrichmentQuery{},
59-
map[string]any{"ids": []githubv4.ID{githubv4.ID(nodeID)}},
57+
return githubv4mock.NewQueryMatcher(
58+
issueReadEnrichmentQueryString,
59+
map[string]any{"ids": []any{nodeID}},
6060
response,
6161
)
62-
matcher.Variables = map[string]any{"ids": []any{nodeID}}
63-
return matcher
6462
}
6563

6664
func (rt *repoAccessMockTransport) RoundTrip(req *http.Request) (*http.Response, error) {

0 commit comments

Comments
 (0)