MCPcopy Create free account
hub / github.com/diillson/chatcli / TestBootstrapMCPSkipsWhenDisabled

Function TestBootstrapMCPSkipsWhenDisabled

cli/mcp_bootstrap_test.go:63–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func 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
79func TestBootstrapMCPInitsManagerWhenDirExists(t *testing.T) {
80 // Mirrors the chatcli first-run experience: ~/.chatcli/ exists

Callers

nothing calls this directly

Calls 2

bootstrapMCPMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected