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

Function TestResolveEnabledToolsets

pkg/github/server_test.go:282–328  ·  view source on GitHub ↗

TestResolveEnabledToolsets verifies the toolset resolution logic.

(t *testing.T)

Source from the content-addressed store, hash-verified

280
281// TestResolveEnabledToolsets verifies the toolset resolution logic.
282func TestResolveEnabledToolsets(t *testing.T) {
283 t.Parallel()
284
285 tests := []struct {
286 name string
287 cfg MCPServerConfig
288 expectedResult []string
289 }{
290 {
291 name: "nil toolsets and no tools - use defaults",
292 cfg: MCPServerConfig{
293 EnabledToolsets: nil,
294 EnabledTools: nil,
295 },
296 expectedResult: nil, // nil means "use defaults"
297 },
298 {
299 name: "explicit toolsets",
300 cfg: MCPServerConfig{
301 EnabledToolsets: []string{"repos", "issues"},
302 },
303 expectedResult: []string{"repos", "issues"},
304 },
305 {
306 name: "empty toolsets - disable all",
307 cfg: MCPServerConfig{
308 EnabledToolsets: []string{},
309 },
310 expectedResult: []string{},
311 },
312 {
313 name: "specific tools without toolsets - no default toolsets",
314 cfg: MCPServerConfig{
315 EnabledToolsets: nil,
316 EnabledTools: []string{"get_me"},
317 },
318 expectedResult: []string{}, // empty slice when tools specified but no toolsets
319 },
320 }
321
322 for _, tc := range tests {
323 t.Run(tc.name, func(t *testing.T) {
324 result := ResolvedEnabledToolsets(tc.cfg.EnabledToolsets, tc.cfg.EnabledTools)
325 assert.Equal(t, tc.expectedResult, result)
326 })
327 }
328}
329
330func TestCompletionsHandler_RejectsMissingRef(t *testing.T) {
331 getClient := func(_ context.Context) (*gogithub.Client, error) {

Callers

nothing calls this directly

Calls 1

ResolvedEnabledToolsetsFunction · 0.85

Tested by

no test coverage detected