MCPcopy Index your code
hub / github.com/github/github-mcp-server / Test_DiscussionCommentWrite_Add

Function Test_DiscussionCommentWrite_Add

pkg/github/discussions_test.go:975–1101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

973}
974
975func Test_DiscussionCommentWrite_Add(t *testing.T) {
976 t.Parallel()
977
978 discussionQueryMatcher := discussionCommentWriteDiscussionQueryMatcher(
979 1,
980 githubv4mock.DataResponse(map[string]any{
981 "repository": map[string]any{
982 "discussion": map[string]any{
983 "id": "D_kwDOTest123",
984 },
985 },
986 }),
987 )
988
989 runDiscussionCommentWriteTests(t, []discussionCommentWriteTestCase{
990 {
991 name: "add: successful comment creation",
992 requestArgs: map[string]any{
993 "method": "add",
994 "owner": "owner",
995 "repo": "repo",
996 "discussionNumber": int32(1),
997 "body": "This is a test comment",
998 },
999 mockedClient: githubv4mock.NewMockedHTTPClient(
1000 discussionQueryMatcher,
1001 githubv4mock.NewMutationMatcher(
1002 struct {
1003 AddDiscussionComment struct {
1004 Comment struct {
1005 ID githubv4.ID
1006 URL githubv4.String `graphql:"url"`
1007 }
1008 } `graphql:"addDiscussionComment(input: $input)"`
1009 }{},
1010 githubv4.AddDiscussionCommentInput{
1011 DiscussionID: githubv4.ID("D_kwDOTest123"),
1012 Body: githubv4.String("This is a test comment"),
1013 },
1014 nil,
1015 githubv4mock.DataResponse(map[string]any{
1016 "addDiscussionComment": map[string]any{
1017 "comment": map[string]any{
1018 "id": "DC_kwDOComment456",
1019 "url": "https://github.com/owner/repo/discussions/1#discussioncomment-456",
1020 },
1021 },
1022 }),
1023 ),
1024 ),
1025 expectedID: "DC_kwDOComment456",
1026 expectedURL: "https://github.com/owner/repo/discussions/1#discussioncomment-456",
1027 },
1028 {
1029 name: "add: discussion not found",
1030 requestArgs: map[string]any{
1031 "method": "add",
1032 "owner": "owner",

Callers

nothing calls this directly

Calls 8

DataResponseFunction · 0.92
NewMockedHTTPClientFunction · 0.92
NewMutationMatcherFunction · 0.92
NewQueryMatcherFunction · 0.92
ErrorResponseFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected