@@ -292,7 +292,13 @@ func Test_repositoryResourceContentsHandler_NetworkError(t *testing.T) {
292292 httpClient := & http.Client {Transport : & errorTransport {err : networkErr }}
293293 client := github .NewClient (httpClient )
294294 mockRawClient := raw .NewClient (client , base )
295- handler := RepositoryResourceContentsHandler (stubGetClientFn (client ), stubGetRawClientFn (mockRawClient ), repositoryResourceContentURITemplate )
295+ deps := BaseDeps {
296+ Client : client ,
297+ RawClient : mockRawClient ,
298+ }
299+ ctx := ContextWithDeps (context .Background (), deps )
300+
301+ handler := RepositoryResourceContentsHandler (repositoryResourceContentURITemplate )
296302
297303 request := & mcp.ReadResourceRequest {
298304 Params : & mcp.ReadResourceParams {
@@ -301,31 +307,8 @@ func Test_repositoryResourceContentsHandler_NetworkError(t *testing.T) {
301307 }
302308
303309 // This should not panic, even though the HTTP client returns an error
304- resp , err := handler (context . TODO () , request )
310+ resp , err := handler (ctx , request )
305311 require .Error (t , err )
306312 require .Nil (t , resp )
307313 require .ErrorContains (t , err , "failed to get raw content" )
308314}
309-
310- func Test_GetRepositoryResourceContent (t * testing.T ) {
311- mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
312- tmpl , _ := GetRepositoryResourceContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
313- require .Equal (t , "repo://{owner}/{repo}/contents{/path*}" , tmpl .URITemplate )
314- }
315-
316- func Test_GetRepositoryResourceBranchContent (t * testing.T ) {
317- mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
318- tmpl , _ := GetRepositoryResourceBranchContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
319- require .Equal (t , "repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}" , tmpl .URITemplate )
320- }
321- func Test_GetRepositoryResourceCommitContent (t * testing.T ) {
322- mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
323- tmpl , _ := GetRepositoryResourceCommitContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
324- require .Equal (t , "repo://{owner}/{repo}/sha/{sha}/contents{/path*}" , tmpl .URITemplate )
325- }
326-
327- func Test_GetRepositoryResourceTagContent (t * testing.T ) {
328- mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
329- tmpl , _ := GetRepositoryResourceTagContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
330- require .Equal (t , "repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}" , tmpl .URITemplate )
331- }
0 commit comments