(t *testing.T)
| 3867 | } |
| 3868 | |
| 3869 | func Test_GetSubIssues(t *testing.T) { |
| 3870 | // Verify tool definition once |
| 3871 | serverTool := IssueRead(translations.NullTranslationHelper) |
| 3872 | tool := serverTool.Tool |
| 3873 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 3874 | |
| 3875 | assert.Equal(t, "issue_read", tool.Name) |
| 3876 | assert.NotEmpty(t, tool.Description) |
| 3877 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method") |
| 3878 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") |
| 3879 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") |
| 3880 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number") |
| 3881 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "page") |
| 3882 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "perPage") |
| 3883 | assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"method", "owner", "repo", "issue_number"}) |
| 3884 | |
| 3885 | // Setup mock sub-issues for success case |
| 3886 | mockSubIssues := []*github.Issue{ |
| 3887 | { |
| 3888 | Number: github.Ptr(123), |
| 3889 | Title: github.Ptr("Sub-issue 1"), |
| 3890 | Body: github.Ptr("This is the first sub-issue"), |
| 3891 | State: github.Ptr("open"), |
| 3892 | HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"), |
| 3893 | User: &github.User{ |
| 3894 | Login: github.Ptr("user1"), |
| 3895 | }, |
| 3896 | Labels: []*github.Label{ |
| 3897 | { |
| 3898 | Name: github.Ptr("bug"), |
| 3899 | Color: github.Ptr("d73a4a"), |
| 3900 | Description: github.Ptr("Something isn't working"), |
| 3901 | }, |
| 3902 | }, |
| 3903 | }, |
| 3904 | { |
| 3905 | Number: github.Ptr(124), |
| 3906 | Title: github.Ptr("Sub-issue 2"), |
| 3907 | Body: github.Ptr("This is the second sub-issue"), |
| 3908 | State: github.Ptr("closed"), |
| 3909 | HTMLURL: github.Ptr("https://github.com/owner/repo/issues/124"), |
| 3910 | User: &github.User{ |
| 3911 | Login: github.Ptr("user2"), |
| 3912 | }, |
| 3913 | Assignees: []*github.User{ |
| 3914 | {Login: github.Ptr("assignee1")}, |
| 3915 | }, |
| 3916 | }, |
| 3917 | } |
| 3918 | |
| 3919 | tests := []struct { |
| 3920 | name string |
| 3921 | mockedClient *http.Client |
| 3922 | requestArgs map[string]any |
| 3923 | expectError bool |
| 3924 | expectedSubIssues []*github.Issue |
| 3925 | expectedErrMsg string |
| 3926 | }{ |
nothing calls this directly
no test coverage detected