Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd39cee2

Browse files
committed
WIP
1 parent192a38a commitd39cee2

File tree

4 files changed

+291
-70
lines changed

4 files changed

+291
-70
lines changed

‎e2e/e2e_test.go

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
10081008
"owner":currentOwner,
10091009
"repo":repoName,
10101010
"path":"test-file.txt",
1011-
"content":fmt.Sprintf("Created by e2e test %s",t.Name()),
1011+
"content":fmt.Sprintf("Created by e2e test %s\nwith multiple lines",t.Name()),
10121012
"message":"Add test file",
10131013
"branch":"test-branch",
10141014
}
@@ -1065,21 +1065,62 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
10651065
require.True(t,ok,"expected content to be of type TextContent")
10661066
require.Equal(t,"",textContent.Text,"expected content to be empty")
10671067

1068-
// Add a review comment
1069-
addReviewCommentRequest:= mcp.CallToolRequest{}
1070-
addReviewCommentRequest.Params.Name="add_pull_request_review_comment_to_pending_review"
1071-
addReviewCommentRequest.Params.Arguments=map[string]any{
1068+
// Add a file review comment
1069+
addFileReviewCommentRequest:= mcp.CallToolRequest{}
1070+
addFileReviewCommentRequest.Params.Name="add_pull_request_review_comment_to_pending_review"
1071+
addFileReviewCommentRequest.Params.Arguments=map[string]any{
1072+
"owner":currentOwner,
1073+
"repo":repoName,
1074+
"pullNumber":1,
1075+
"path":"test-file.txt",
1076+
"subjectType":"FILE",
1077+
"body":"File review comment",
1078+
}
1079+
1080+
t.Logf("Adding file review comment to pull request in %s/%s...",currentOwner,repoName)
1081+
resp,err=mcpClient.CallTool(ctx,addFileReviewCommentRequest)
1082+
require.NoError(t,err,"expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
1083+
require.False(t,resp.IsError,fmt.Sprintf("expected result not to be an error: %+v",resp))
1084+
1085+
// Add a single line review comment
1086+
addSingleLineReviewCommentRequest:= mcp.CallToolRequest{}
1087+
addSingleLineReviewCommentRequest.Params.Name="add_pull_request_review_comment_to_pending_review"
1088+
addSingleLineReviewCommentRequest.Params.Arguments=map[string]any{
10721089
"owner":currentOwner,
10731090
"repo":repoName,
10741091
"pullNumber":1,
10751092
"path":"test-file.txt",
10761093
"subjectType":"LINE",
1077-
"body":"Very nice!",
1094+
"body":"Single line review comment",
10781095
"line":1,
1096+
"side":"RIGHT",
1097+
"commitId":commitId,
10791098
}
10801099

1081-
t.Logf("Adding review comment to pull request in %s/%s...",currentOwner,repoName)
1082-
resp,err=mcpClient.CallTool(ctx,addReviewCommentRequest)
1100+
t.Logf("Adding single line review comment to pull request in %s/%s...",currentOwner,repoName)
1101+
resp,err=mcpClient.CallTool(ctx,addSingleLineReviewCommentRequest)
1102+
require.NoError(t,err,"expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
1103+
require.False(t,resp.IsError,fmt.Sprintf("expected result not to be an error: %+v",resp))
1104+
1105+
// Add a multiline review comment
1106+
addMultilineReviewCommentRequest:= mcp.CallToolRequest{}
1107+
addMultilineReviewCommentRequest.Params.Name="add_pull_request_review_comment_to_pending_review"
1108+
addMultilineReviewCommentRequest.Params.Arguments=map[string]any{
1109+
"owner":currentOwner,
1110+
"repo":repoName,
1111+
"pullNumber":1,
1112+
"path":"test-file.txt",
1113+
"subjectType":"LINE",
1114+
"body":"Multiline review comment",
1115+
"startLine":1,
1116+
"line":2,
1117+
"startSide":"RIGHT",
1118+
"side":"RIGHT",
1119+
"commitId":commitId,
1120+
}
1121+
1122+
t.Logf("Adding multi line review comment to pull request in %s/%s...",currentOwner,repoName)
1123+
resp,err=mcpClient.CallTool(ctx,addMultilineReviewCommentRequest)
10831124
require.NoError(t,err,"expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
10841125
require.False(t,resp.IsError,fmt.Sprintf("expected result not to be an error: %+v",resp))
10851126

@@ -1117,6 +1158,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
11171158
require.True(t,ok,"expected content to be of type TextContent")
11181159

11191160
varreviews []struct {
1161+
IDint`json:"id"`
11201162
Statestring`json:"state"`
11211163
}
11221164
err=json.Unmarshal([]byte(textContent.Text),&reviews)
@@ -1125,6 +1167,13 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
11251167
// Check that there is one review
11261168
require.Len(t,reviews,1,"expected to find one review")
11271169
require.Equal(t,"COMMENTED",reviews[0].State,"expected review state to be COMMENTED")
1170+
1171+
// Check that there are three review comments
1172+
// MCP Server doesn't support this, but we can use the GitHub Client
1173+
ghClient:=gogithub.NewClient(nil).WithAuthToken(getE2EToken(t))
1174+
comments,_,err:=ghClient.PullRequests.ListReviewComments(context.Background(),currentOwner,repoName,1,int64(reviews[0].ID),nil)
1175+
require.NoError(t,err,"expected to list review comments successfully")
1176+
require.Equal(t,3,len(comments),"expected to find three review comments")
11281177
}
11291178

11301179
funcTestPullRequestReviewDeletion(t*testing.T) {
@@ -1314,5 +1363,4 @@ func TestPullRequestReviewDeletion(t *testing.T) {
13141363
err=json.Unmarshal([]byte(textContent.Text),&noReviews)
13151364
require.NoError(t,err,"expected to unmarshal text content successfully")
13161365
require.Len(t,noReviews,0,"expected to find no reviews")
1317-
13181366
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp