(t *testing.T)
| 219 | } |
| 220 | |
| 221 | func TestDetectFromMCPConfigs(t *testing.T) { |
| 222 | tests := []struct { |
| 223 | name string |
| 224 | tools map[string]any |
| 225 | expected []string |
| 226 | }{ |
| 227 | { |
| 228 | name: "detects node from MCP command", |
| 229 | tools: map[string]any{ |
| 230 | "custom-tool": map[string]any{ |
| 231 | "command": "node", |
| 232 | "args": []string{"server.js"}, |
| 233 | }, |
| 234 | }, |
| 235 | expected: []string{"node"}, |
| 236 | }, |
| 237 | { |
| 238 | name: "detects python from MCP command", |
| 239 | tools: map[string]any{ |
| 240 | "custom-tool": map[string]any{ |
| 241 | "command": "python", |
| 242 | "args": []string{"-m", "server"}, |
| 243 | }, |
| 244 | }, |
| 245 | expected: []string{"python"}, |
| 246 | }, |
| 247 | { |
| 248 | name: "detects npx from MCP command", |
| 249 | tools: map[string]any{ |
| 250 | "custom-playwright": map[string]any{ |
| 251 | "command": "npx", |
| 252 | "args": []string{"@playwright/mcp"}, |
| 253 | }, |
| 254 | }, |
| 255 | expected: []string{"node"}, |
| 256 | }, |
| 257 | { |
| 258 | name: "no detection for non-runtime commands", |
| 259 | tools: map[string]any{ |
| 260 | "docker-tool": map[string]any{ |
| 261 | "command": "docker", |
| 262 | "args": []string{"run"}, |
| 263 | }, |
| 264 | }, |
| 265 | expected: []string{}, |
| 266 | }, |
| 267 | } |
| 268 | |
| 269 | for _, tt := range tests { |
| 270 | t.Run(tt.name, func(t *testing.T) { |
| 271 | requirements := make(map[string]*RuntimeRequirement) |
| 272 | parsedTools := NewTools(tt.tools) |
| 273 | detectFromMCPConfigs(parsedTools, requirements) |
| 274 | |
| 275 | if len(requirements) != len(tt.expected) { |
| 276 | t.Errorf("Expected %d requirements, got %d: %v", len(tt.expected), len(requirements), getRequirementIDs(requirements)) |
| 277 | } |
| 278 |
nothing calls this directly
no test coverage detected