@@ -1435,11 +1435,6 @@ func Test_CreateIssue(t *testing.T) {
14351435 assert .Contains (t , tool .InputSchema .(* jsonschema.Schema ).Properties , "labels" )
14361436 assert .Contains (t , tool .InputSchema .(* jsonschema.Schema ).Properties , "milestone" )
14371437 assert .Contains (t , tool .InputSchema .(* jsonschema.Schema ).Properties , "type" )
1438- issueTypeSchema := tool .InputSchema .(* jsonschema.Schema ).Properties ["type" ]
1439- require .Len (t , issueTypeSchema .AnyOf , 2 )
1440- assert .Equal (t , "string" , issueTypeSchema .AnyOf [0 ].Type )
1441- assert .Equal (t , 1 , * issueTypeSchema .AnyOf [0 ].MinLength )
1442- assert .Equal (t , "null" , issueTypeSchema .AnyOf [1 ].Type )
14431438 assert .Contains (t , tool .InputSchema .(* jsonschema.Schema ).Properties , "issue_fields" )
14441439 assert .ElementsMatch (t , tool .InputSchema .(* jsonschema.Schema ).Required , []string {"method" , "owner" , "repo" })
14451440
@@ -1518,18 +1513,6 @@ func Test_CreateIssue(t *testing.T) {
15181513 State : github .Ptr ("open" ),
15191514 },
15201515 },
1521- {
1522- name : "empty issue type is rejected when creating" ,
1523- mockedClient : MockHTTPClientWithHandlers (nil ),
1524- requestArgs : map [string ]any {
1525- "method" : "create" ,
1526- "owner" : "owner" ,
1527- "repo" : "repo" ,
1528- "title" : "Issue without a type" ,
1529- "type" : "" ,
1530- },
1531- expectedErrMsg : "parameter type must not be empty" ,
1532- },
15331516 {
15341517 name : "successful issue creation with issue fields reconciled by names" ,
15351518 mockedClient : MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
@@ -2891,83 +2874,7 @@ func TestIssueWriteUpdatesIssueType(t *testing.T) {
28912874 }
28922875}
28932876
2894- func TestIssueWriteRejectsEmptyIssueType (t * testing.T ) {
2895- tests := []struct {
2896- name string
2897- args map [string ]any
2898- }{
2899- {
2900- name : "create" ,
2901- args : map [string ]any {
2902- "method" : "create" ,
2903- "title" : "New issue" ,
2904- },
2905- },
2906- {
2907- name : "update" ,
2908- args : map [string ]any {
2909- "method" : "update" ,
2910- "issue_number" : float64 (123 ),
2911- },
2912- },
2913- }
2914-
2915- for _ , tc := range tests {
2916- t .Run (tc .name , func (t * testing.T ) {
2917- deps := BaseDeps {Client : mustNewGHClient (t , MockHTTPClientWithHandlers (nil ))}
2918- serverTool := IssueWrite (translations .NullTranslationHelper )
2919- handler := serverTool .Handler (deps )
2920- args := map [string ]any {
2921- "owner" : "owner" ,
2922- "repo" : "repo" ,
2923- "type" : "" ,
2924- }
2925- maps .Copy (args , tc .args )
2926- request := createMCPRequest (args )
2927-
2928- result , err := handler (ContextWithDeps (context .Background (), deps ), & request )
2929- require .NoError (t , err )
2930- errorContent := getErrorResult (t , result )
2931- assert .Contains (t , errorContent .Text , "parameter type must not be empty" )
2932- })
2933- }
2934- }
2935-
2936- func TestIssueWriteClearTypeBypassesMCPAppForm (t * testing.T ) {
2937- var gotRequestBody []byte
2938- var readErr error
2939- client := mustNewGHClient (t , MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
2940- PatchReposIssuesByOwnerByRepoByIssueNumber : func (w http.ResponseWriter , r * http.Request ) {
2941- gotRequestBody , readErr = io .ReadAll (r .Body )
2942- w .WriteHeader (http .StatusOK )
2943- _ , _ = w .Write ([]byte (`{"number":123,"html_url":"https://github.com/owner/repo/issues/123"}` ))
2944- },
2945- }))
2946- deps := BaseDeps {
2947- Client : client ,
2948- GQLClient : githubv4 .NewClient (githubv4mock .NewMockedHTTPClient ()),
2949- featureChecker : featureCheckerFor (MCPAppsFeatureFlag ),
2950- }
2951- serverTool := IssueWrite (translations .NullTranslationHelper )
2952- handler := serverTool .Handler (deps )
2953- request := createMCPRequestWithSession (t , ClientNameVSCodeInsiders , true , map [string ]any {
2954- "method" : "update" ,
2955- "owner" : "owner" ,
2956- "repo" : "repo" ,
2957- "issue_number" : float64 (123 ),
2958- "type" : nil ,
2959- })
2960-
2961- result , err := handler (ContextWithDeps (context .Background (), deps ), & request )
2962- require .NoError (t , err )
2963- require .False (t , result .IsError )
2964- require .NoError (t , readErr )
2965- require .JSONEq (t , `{"type":null}` , string (gotRequestBody ))
2966- textContent := getTextResult (t , result )
2967- require .Contains (t , textContent .Text , "https://github.com/owner/repo/issues/123" )
2968- }
2969-
2970- func TestIssueWriteClearTypeBypassesMCPAppFormWithStateChange (t * testing.T ) {
2877+ func TestIssueWriteNullTypeBypassesMCPAppFormWithStateChange (t * testing.T ) {
29712878 var gotRequestBody []byte
29722879 var readErr error
29732880 client := mustNewGHClient (t , MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
@@ -3049,8 +2956,6 @@ func TestIssueWriteClearTypeBypassesMCPAppFormWithStateChange(t *testing.T) {
30492956 require .False (t , result .IsError )
30502957 require .NoError (t , readErr )
30512958 require .JSONEq (t , `{"type":null}` , string (gotRequestBody ))
3052- textContent := getTextResult (t , result )
3053- require .Contains (t , textContent .Text , "https://github.com/owner/repo/issues/123" )
30542959}
30552960
30562961func Test_UpdateIssue (t * testing.T ) {
0 commit comments