(t *testing.T)
| 3414 | } |
| 3415 | |
| 3416 | func Test_GetIssueLabels(t *testing.T) { |
| 3417 | t.Parallel() |
| 3418 | |
| 3419 | // Verify tool definition |
| 3420 | serverTool := IssueRead(translations.NullTranslationHelper) |
| 3421 | tool := serverTool.Tool |
| 3422 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 3423 | |
| 3424 | assert.Equal(t, "issue_read", tool.Name) |
| 3425 | assert.NotEmpty(t, tool.Description) |
| 3426 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method") |
| 3427 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") |
| 3428 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") |
| 3429 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number") |
| 3430 | assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"method", "owner", "repo", "issue_number"}) |
| 3431 | |
| 3432 | tests := []struct { |
| 3433 | name string |
| 3434 | requestArgs map[string]any |
| 3435 | mockedClient *http.Client |
| 3436 | expectToolError bool |
| 3437 | expectedToolErrMsg string |
| 3438 | }{ |
| 3439 | { |
| 3440 | name: "successful issue labels listing", |
| 3441 | requestArgs: map[string]any{ |
| 3442 | "method": "get_labels", |
| 3443 | "owner": "owner", |
| 3444 | "repo": "repo", |
| 3445 | "issue_number": float64(123), |
| 3446 | }, |
| 3447 | mockedClient: githubv4mock.NewMockedHTTPClient( |
| 3448 | githubv4mock.NewQueryMatcher( |
| 3449 | struct { |
| 3450 | Repository struct { |
| 3451 | Issue struct { |
| 3452 | Labels struct { |
| 3453 | Nodes []struct { |
| 3454 | ID githubv4.ID |
| 3455 | Name githubv4.String |
| 3456 | Color githubv4.String |
| 3457 | Description githubv4.String |
| 3458 | } |
| 3459 | TotalCount githubv4.Int |
| 3460 | } `graphql:"labels(first: 100)"` |
| 3461 | } `graphql:"issue(number: $issueNumber)"` |
| 3462 | } `graphql:"repository(owner: $owner, name: $repo)"` |
| 3463 | }{}, |
| 3464 | map[string]any{ |
| 3465 | "owner": githubv4.String("owner"), |
| 3466 | "repo": githubv4.String("repo"), |
| 3467 | "issueNumber": githubv4.Int(123), |
| 3468 | }, |
| 3469 | githubv4mock.DataResponse(map[string]any{ |
| 3470 | "repository": map[string]any{ |
| 3471 | "issue": map[string]any{ |
| 3472 | "labels": map[string]any{ |
| 3473 | "nodes": []any{ |
nothing calls this directly
no test coverage detected