(t *testing.T)
| 135 | } |
| 136 | |
| 137 | func 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 | |
| 155 | func TestParseFrontmatter(t *testing.T) { |
| 156 | name, desc, ok := parseFrontmatter("---\nname: foo\ndescription: bar baz\n---\nbody") |
nothing calls this directly
no test coverage detected