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

Function TestToolsValidation

cli/plugins/builtin_tools_test.go:94–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestToolsValidation(t *testing.T) {
95 withFakeCatalog(t)
96 p := NewBuiltinToolsPlugin()
97
98 if _, err := p.Execute(context.Background(), []string{`{"cmd":"describe","args":{}}`}); err == nil || !strings.Contains(err.Error(), `"name" is required`) {
99 t.Fatalf("missing name must error, got %v", err)
100 }
101 if _, err := p.Execute(context.Background(), []string{`{"cmd":"install"}`}); err == nil || !strings.Contains(err.Error(), "unknown cmd") {
102 t.Fatalf("unknown cmd must error, got %v", err)
103 }
104 SetToolCatalogAdapter(nil)
105 if _, err := p.Execute(context.Background(), []string{`{"cmd":"list"}`}); err == nil {
106 t.Fatal("missing adapter must error, not panic")
107 }
108}
109
110func TestToolsCaps(t *testing.T) {
111 p := NewBuiltinToolsPlugin()

Callers

nothing calls this directly

Calls 5

ExecuteMethod · 0.95
withFakeCatalogFunction · 0.85
NewBuiltinToolsPluginFunction · 0.85
SetToolCatalogAdapterFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected