MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / TestDiscoverPlugins

Function TestDiscoverPlugins

internal/metadata/discover_test.go:137–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestDiscoverPlugins(t *testing.T) {
138 root := t.TempDir()
139 writeFile(t, filepath.Join(root, "my-plugin", ".claude-plugin", "plugin.json"), `{"name":"my-plugin","description":"A plugin"}`)
140 writeFile(t, filepath.Join(root, "other", "plugin.json"), `{"name":"other","description":"Other plugin"}`)
141
142 res := DiscoverResources(root, "", entities.KindPlugin)
143 if len(res) != 2 {
144 t.Fatalf("expected 2 plugins, got %d: %+v", len(res), res)
145 }
146 byName := map[string]string{}
147 for _, r := range res {
148 byName[r.Name] = r.Description
149 }
150 if byName["my-plugin"] != "A plugin" {
151 t.Fatalf("my-plugin desc = %q", byName["my-plugin"])
152 }
153}
154
155func TestParseFrontmatter(t *testing.T) {
156 name, desc, ok := parseFrontmatter("---\nname: foo\ndescription: bar baz\n---\nbody")

Callers

nothing calls this directly

Calls 2

DiscoverResourcesFunction · 0.85
writeFileFunction · 0.70

Tested by

no test coverage detected