(t *testing.T)
| 931 | } |
| 932 | |
| 933 | func Test_DiscussionCommentWrite(t *testing.T) { |
| 934 | t.Parallel() |
| 935 | |
| 936 | toolDef := DiscussionCommentWrite(translations.NullTranslationHelper) |
| 937 | tool := toolDef.Tool |
| 938 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 939 | |
| 940 | assert.Equal(t, "discussion_comment_write", tool.Name) |
| 941 | assert.NotEmpty(t, tool.Description) |
| 942 | assert.False(t, tool.Annotations.ReadOnlyHint, "discussion_comment_write should not be read-only") |
| 943 | require.NotNil(t, tool.Annotations.DestructiveHint) |
| 944 | assert.True(t, *tool.Annotations.DestructiveHint, "discussion_comment_write should be destructive") |
| 945 | schema, ok := tool.InputSchema.(*jsonschema.Schema) |
| 946 | require.True(t, ok, "InputSchema should be *jsonschema.Schema") |
| 947 | assert.Contains(t, schema.Properties, "method") |
| 948 | assert.Contains(t, schema.Properties, "owner") |
| 949 | assert.Contains(t, schema.Properties, "repo") |
| 950 | assert.Contains(t, schema.Properties, "discussionNumber") |
| 951 | assert.Contains(t, schema.Properties, "body") |
| 952 | assert.Contains(t, schema.Properties, "commentNodeID") |
| 953 | assert.ElementsMatch(t, schema.Required, []string{"method"}) |
| 954 | |
| 955 | runDiscussionCommentWriteTests(t, []discussionCommentWriteTestCase{ |
| 956 | { |
| 957 | name: "method: missing", |
| 958 | requestArgs: map[string]any{}, |
| 959 | mockedClient: githubv4mock.NewMockedHTTPClient(), |
| 960 | expectToolError: true, |
| 961 | expectedErrMsg: "missing required parameter: method", |
| 962 | }, |
| 963 | { |
| 964 | name: "invalid method", |
| 965 | requestArgs: map[string]any{ |
| 966 | "method": "invalid", |
| 967 | }, |
| 968 | mockedClient: githubv4mock.NewMockedHTTPClient(), |
| 969 | expectToolError: true, |
| 970 | expectedErrMsg: "invalid method, must be one of: 'add', 'reply', 'update', 'delete', 'mark_answer', 'unmark_answer'", |
| 971 | }, |
| 972 | }) |
| 973 | } |
| 974 | |
| 975 | func Test_DiscussionCommentWrite_Add(t *testing.T) { |
| 976 | t.Parallel() |
nothing calls this directly
no test coverage detected