MCPcopy
hub / github.com/github/github-mcp-server / TestWithExcludeTools

Function TestWithExcludeTools

pkg/inventory/registry_test.go:2056–2142  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2054}
2055
2056func TestWithExcludeTools(t *testing.T) {
2057 tools := []ServerTool{
2058 mockTool("tool1", "toolset1", true),
2059 mockTool("tool2", "toolset1", true),
2060 mockTool("tool3", "toolset2", true),
2061 }
2062
2063 tests := []struct {
2064 name string
2065 excluded []string
2066 toolsets []string
2067 expectedNames []string
2068 unexpectedNames []string
2069 }{
2070 {
2071 name: "single tool excluded",
2072 excluded: []string{"tool2"},
2073 toolsets: []string{"all"},
2074 expectedNames: []string{"tool1", "tool3"},
2075 unexpectedNames: []string{"tool2"},
2076 },
2077 {
2078 name: "multiple tools excluded",
2079 excluded: []string{"tool1", "tool3"},
2080 toolsets: []string{"all"},
2081 expectedNames: []string{"tool2"},
2082 unexpectedNames: []string{"tool1", "tool3"},
2083 },
2084 {
2085 name: "empty excluded list is a no-op",
2086 excluded: []string{},
2087 toolsets: []string{"all"},
2088 expectedNames: []string{"tool1", "tool2", "tool3"},
2089 unexpectedNames: nil,
2090 },
2091 {
2092 name: "nil excluded list is a no-op",
2093 excluded: nil,
2094 toolsets: []string{"all"},
2095 expectedNames: []string{"tool1", "tool2", "tool3"},
2096 unexpectedNames: nil,
2097 },
2098 {
2099 name: "excluding non-existent tool is a no-op",
2100 excluded: []string{"nonexistent"},
2101 toolsets: []string{"all"},
2102 expectedNames: []string{"tool1", "tool2", "tool3"},
2103 unexpectedNames: nil,
2104 },
2105 {
2106 name: "exclude all tools",
2107 excluded: []string{"tool1", "tool2", "tool3"},
2108 toolsets: []string{"all"},
2109 expectedNames: nil,
2110 unexpectedNames: []string{"tool1", "tool2", "tool3"},
2111 },
2112 {
2113 name: "whitespace is trimmed",

Callers

nothing calls this directly

Calls 7

mustBuildFunction · 0.85
NewBuilderFunction · 0.85
WithExcludeToolsMethod · 0.80
WithToolsetsMethod · 0.80
SetToolsMethod · 0.80
AvailableToolsMethod · 0.80
mockToolFunction · 0.70

Tested by

no test coverage detected