MCPcopy
hub / github.com/github/github-mcp-server / TestGranularSetIssueFields

Function TestGranularSetIssueFields

pkg/github/granular_tools_test.go:1349–2034  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1347}
1348
1349func TestGranularSetIssueFields(t *testing.T) {
1350 t.Run("successful set with text value", func(t *testing.T) {
1351 matchers := []githubv4mock.Matcher{
1352 // Mock the issue ID query
1353 githubv4mock.NewQueryMatcher(
1354 struct {
1355 Repository struct {
1356 Issue struct {
1357 ID githubv4.ID
1358 } `graphql:"issue(number: $issueNumber)"`
1359 } `graphql:"repository(owner: $owner, name: $repo)"`
1360 }{},
1361 map[string]any{
1362 "owner": githubv4.String("owner"),
1363 "repo": githubv4.String("repo"),
1364 "issueNumber": githubv4.Int(5),
1365 },
1366 githubv4mock.DataResponse(map[string]any{
1367 "repository": map[string]any{
1368 "issue": map[string]any{"id": "ISSUE_123"},
1369 },
1370 }),
1371 ),
1372 // Mock the setIssueFieldValue mutation
1373 githubv4mock.NewMutationMatcher(
1374 struct {
1375 SetIssueFieldValue struct {
1376 Issue struct {
1377 ID githubv4.ID
1378 Number githubv4.Int
1379 URL githubv4.String
1380 }
1381 IssueFieldValues []struct {
1382 TextValue struct {
1383 Value string
1384 } `graphql:"... on IssueFieldTextValue"`
1385 SingleSelectValue struct {
1386 Name string
1387 } `graphql:"... on IssueFieldSingleSelectValue"`
1388 DateValue struct {
1389 Value string
1390 } `graphql:"... on IssueFieldDateValue"`
1391 NumberValue struct {
1392 Value float64
1393 } `graphql:"... on IssueFieldNumberValue"`
1394 }
1395 } `graphql:"setIssueFieldValue(input: $input)"`
1396 }{},
1397 SetIssueFieldValueInput{
1398 IssueID: githubv4.ID("ISSUE_123"),
1399 IssueFields: []IssueFieldCreateOrUpdateInput{
1400 {
1401 FieldID: githubv4.ID("FIELD_1"),
1402 TextValue: githubv4.NewString(githubv4.String("hello")),
1403 },
1404 },
1405 },
1406 nil,

Callers

nothing calls this directly

Calls 10

NewQueryMatcherFunction · 0.92
DataResponseFunction · 0.92
NewMutationMatcherFunction · 0.92
NewMockedHTTPClientFunction · 0.92
GranularSetIssueFieldsFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
getTextResultFunction · 0.85
StringMethod · 0.45
HandlerMethod · 0.45

Tested by

no test coverage detected