(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestBootstrapMCPSkipsWhenDisabled(t *testing.T) { |
| 64 | // CHATCLI_MCP_ENABLED unset + a fully-bogus config path means |
| 65 | // bootstrap should skip the entire subsystem. Important so users |
| 66 | // who don't use MCP don't pay the cost of a manager + watcher. |
| 67 | t.Setenv("CHATCLI_MCP_ENABLED", "") |
| 68 | t.Setenv("CHATCLI_MCP_CONFIG", filepath.Join(t.TempDir(), "missing-subdir", "mcp_servers.json")) |
| 69 | cli := &ChatCLI{} |
| 70 | cli.bootstrapMCP(context.Background(), zap.NewNop()) |
| 71 | if cli.mcpManager != nil { |
| 72 | t.Error("manager should not be initialized when MCP is disabled and no path exists") |
| 73 | } |
| 74 | if cli.mcpWatcher != nil { |
| 75 | t.Error("watcher should not start when MCP is disabled") |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | func TestBootstrapMCPInitsManagerWhenDirExists(t *testing.T) { |
| 80 | // Mirrors the chatcli first-run experience: ~/.chatcli/ exists |
nothing calls this directly
no test coverage detected