@@ -985,6 +985,22 @@ func Test_DiscussionCommentWrite(t *testing.T) {
985985 expectedDiscussionID string
986986 expectedDiscussionURL string
987987 }{
988+ {
989+ name : "method: missing" ,
990+ requestArgs : map [string ]any {},
991+ mockedClient : githubv4mock .NewMockedHTTPClient (),
992+ expectToolError : true ,
993+ expectedErrMsg : "missing required parameter: method" ,
994+ },
995+ {
996+ name : "method: empty" ,
997+ requestArgs : map [string ]any {
998+ "method" : "" ,
999+ },
1000+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1001+ expectToolError : true ,
1002+ expectedErrMsg : "missing required parameter: method" ,
1003+ },
9881004 // add method tests
9891005 {
9901006 name : "add: successful comment creation" ,
@@ -1084,6 +1100,54 @@ func Test_DiscussionCommentWrite(t *testing.T) {
10841100 expectToolError : true ,
10851101 expectedErrMsg : "insufficient permissions to comment on this discussion" ,
10861102 },
1103+ {
1104+ name : "add: missing owner" ,
1105+ requestArgs : map [string ]any {
1106+ "method" : "add" ,
1107+ "repo" : "repo" ,
1108+ "discussionNumber" : int32 (1 ),
1109+ "body" : "This is a comment" ,
1110+ },
1111+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1112+ expectToolError : true ,
1113+ expectedErrMsg : "missing required parameter: owner" ,
1114+ },
1115+ {
1116+ name : "add: missing repo" ,
1117+ requestArgs : map [string ]any {
1118+ "method" : "add" ,
1119+ "owner" : "owner" ,
1120+ "discussionNumber" : int32 (1 ),
1121+ "body" : "This is a comment" ,
1122+ },
1123+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1124+ expectToolError : true ,
1125+ expectedErrMsg : "missing required parameter: repo" ,
1126+ },
1127+ {
1128+ name : "add: missing discussion number" ,
1129+ requestArgs : map [string ]any {
1130+ "method" : "add" ,
1131+ "owner" : "owner" ,
1132+ "repo" : "repo" ,
1133+ "body" : "This is a comment" ,
1134+ },
1135+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1136+ expectToolError : true ,
1137+ expectedErrMsg : "missing required parameter: discussionNumber" ,
1138+ },
1139+ {
1140+ name : "add: missing body" ,
1141+ requestArgs : map [string ]any {
1142+ "method" : "add" ,
1143+ "owner" : "owner" ,
1144+ "repo" : "repo" ,
1145+ "discussionNumber" : int32 (1 ),
1146+ },
1147+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1148+ expectToolError : true ,
1149+ expectedErrMsg : "missing required parameter: body" ,
1150+ },
10871151 // reply method tests
10881152 {
10891153 name : "reply: successful reply to comment" ,
@@ -1199,6 +1263,86 @@ func Test_DiscussionCommentWrite(t *testing.T) {
11991263 expectToolError : true ,
12001264 expectedErrMsg : `commentNodeID "DC_kwDOInvalid" does not resolve to a valid discussion comment` ,
12011265 },
1266+ {
1267+ name : "reply: validation query failure" ,
1268+ requestArgs : map [string ]any {
1269+ "method" : "reply" ,
1270+ "owner" : "owner" ,
1271+ "repo" : "repo" ,
1272+ "discussionNumber" : int32 (1 ),
1273+ "body" : "This is a reply" ,
1274+ "commentNodeID" : "DC_kwDOComment456" ,
1275+ },
1276+ mockedClient : githubv4mock .NewMockedHTTPClient (
1277+ githubv4mock .NewQueryMatcher (
1278+ struct {
1279+ Node struct {
1280+ DiscussionComment struct {
1281+ ID githubv4.ID
1282+ } `graphql:"... on DiscussionComment"`
1283+ } `graphql:"node(id: $replyToID)"`
1284+ }{},
1285+ map [string ]any {
1286+ "replyToID" : githubv4 .ID ("DC_kwDOComment456" ),
1287+ },
1288+ githubv4mock .ErrorResponse ("Could not resolve to a node with the global id of 'DC_kwDOComment456'." ),
1289+ ),
1290+ ),
1291+ expectToolError : true ,
1292+ expectedErrMsg : "failed to validate commentNodeID: Could not resolve to a node with the global id of 'DC_kwDOComment456'." ,
1293+ },
1294+ {
1295+ name : "reply: missing owner" ,
1296+ requestArgs : map [string ]any {
1297+ "method" : "reply" ,
1298+ "repo" : "repo" ,
1299+ "discussionNumber" : int32 (1 ),
1300+ "body" : "This is a reply" ,
1301+ "commentNodeID" : "DC_kwDOComment456" ,
1302+ },
1303+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1304+ expectToolError : true ,
1305+ expectedErrMsg : "missing required parameter: owner" ,
1306+ },
1307+ {
1308+ name : "reply: missing repo" ,
1309+ requestArgs : map [string ]any {
1310+ "method" : "reply" ,
1311+ "owner" : "owner" ,
1312+ "discussionNumber" : int32 (1 ),
1313+ "body" : "This is a reply" ,
1314+ "commentNodeID" : "DC_kwDOComment456" ,
1315+ },
1316+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1317+ expectToolError : true ,
1318+ expectedErrMsg : "missing required parameter: repo" ,
1319+ },
1320+ {
1321+ name : "reply: missing discussion number" ,
1322+ requestArgs : map [string ]any {
1323+ "method" : "reply" ,
1324+ "owner" : "owner" ,
1325+ "repo" : "repo" ,
1326+ "body" : "This is a reply" ,
1327+ "commentNodeID" : "DC_kwDOComment456" ,
1328+ },
1329+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1330+ expectToolError : true ,
1331+ expectedErrMsg : "missing required parameter: discussionNumber" ,
1332+ },
1333+ {
1334+ name : "reply: missing body" ,
1335+ requestArgs : map [string ]any {
1336+ "method" : "reply" ,
1337+ "owner" : "owner" ,
1338+ "repo" : "repo" ,
1339+ "discussionNumber" : int32 (1 ),
1340+ "commentNodeID" : "DC_kwDOComment456" ,
1341+ },
1342+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1343+ expectToolError : true ,
1344+ expectedErrMsg : "missing required parameter: body" ,
1345+ },
12021346 // update method tests
12031347 {
12041348 name : "update: successful comment update" ,
@@ -1291,6 +1435,26 @@ func Test_DiscussionCommentWrite(t *testing.T) {
12911435 expectToolError : true ,
12921436 expectedErrMsg : "insufficient permissions to update this discussion comment" ,
12931437 },
1438+ {
1439+ name : "update: missing commentNodeID" ,
1440+ requestArgs : map [string ]any {
1441+ "method" : "update" ,
1442+ "body" : "Updated comment text" ,
1443+ },
1444+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1445+ expectToolError : true ,
1446+ expectedErrMsg : "missing required parameter: commentNodeID" ,
1447+ },
1448+ {
1449+ name : "update: missing body" ,
1450+ requestArgs : map [string ]any {
1451+ "method" : "update" ,
1452+ "commentNodeID" : "DC_kwDOComment456" ,
1453+ },
1454+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1455+ expectToolError : true ,
1456+ expectedErrMsg : "missing required parameter: body" ,
1457+ },
12941458 // delete method tests
12951459 {
12961460 name : "delete: successful comment delete" ,
@@ -1377,6 +1541,15 @@ func Test_DiscussionCommentWrite(t *testing.T) {
13771541 expectToolError : true ,
13781542 expectedErrMsg : "insufficient permissions to delete this discussion comment" ,
13791543 },
1544+ {
1545+ name : "delete: missing commentNodeID" ,
1546+ requestArgs : map [string ]any {
1547+ "method" : "delete" ,
1548+ },
1549+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1550+ expectToolError : true ,
1551+ expectedErrMsg : "missing required parameter: commentNodeID" ,
1552+ },
13801553 // mark_answer method tests
13811554 {
13821555 name : "mark_answer: successful mark as answer" ,
@@ -1437,6 +1610,15 @@ func Test_DiscussionCommentWrite(t *testing.T) {
14371610 expectToolError : true ,
14381611 expectedErrMsg : "discussion is not a Q&A discussion" ,
14391612 },
1613+ {
1614+ name : "mark_answer: missing commentNodeID" ,
1615+ requestArgs : map [string ]any {
1616+ "method" : "mark_answer" ,
1617+ },
1618+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1619+ expectToolError : true ,
1620+ expectedErrMsg : "missing required parameter: commentNodeID" ,
1621+ },
14401622 // unmark_answer method tests
14411623 {
14421624 name : "unmark_answer: successful unmark as answer" ,
@@ -1497,6 +1679,15 @@ func Test_DiscussionCommentWrite(t *testing.T) {
14971679 expectToolError : true ,
14981680 expectedErrMsg : "insufficient permissions" ,
14991681 },
1682+ {
1683+ name : "unmark_answer: missing commentNodeID" ,
1684+ requestArgs : map [string ]any {
1685+ "method" : "unmark_answer" ,
1686+ },
1687+ mockedClient : githubv4mock .NewMockedHTTPClient (),
1688+ expectToolError : true ,
1689+ expectedErrMsg : "missing required parameter: commentNodeID" ,
1690+ },
15001691 // invalid method test
15011692 {
15021693 name : "invalid method" ,
0 commit comments