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

Function seedMetadataDB

internal/cli/cmd_metadata_test.go:15–31  ·  view source on GitHub ↗

seedMetadataDB populates the metadata index directly so CLI search/install tests don't depend on live GitHub downloads.

(t *testing.T, dbPath string)

Source from the content-addressed store, hash-verified

13// seedMetadataDB populates the metadata index directly so CLI search/install
14// tests don't depend on live GitHub downloads.
15func seedMetadataDB(t *testing.T, dbPath string) {
16 t.Helper()
17 ctx := context.Background()
18 store := metadata.NewStore(dbPath)
19 if err := store.Init(ctx); err != nil {
20 t.Fatalf("init metadata store: %v", err)
21 }
22 items := []metadata.Item{
23 {Kind: "skill", Name: "superpowers", Description: "Skill bundle", RepoOwner: "obra", RepoName: "superpowers", RepoBranch: "main", InstallKey: "obra/superpowers:superpowers", TargetApps: "claude,codex"},
24 {Kind: "agent", Name: "code-reviewer", Description: "Reviews code", RepoOwner: "iannuttall", RepoName: "claude-agents", RepoBranch: "main", InstallKey: "iannuttall/claude-agents:code-reviewer", TargetApps: "claude"},
25 }
26 for _, it := range items {
27 if err := store.UpsertItem(ctx, it); err != nil {
28 t.Fatalf("seed upsert: %v", err)
29 }
30 }
31}
32
33func TestMetadataRefreshCommand(t *testing.T) {
34 if testing.Short() || os.Getenv("CAM_RUN_LIVE_TESTS") != "1" {

Callers 2

Calls 3

InitMethod · 0.95
UpsertItemMethod · 0.95
NewStoreFunction · 0.92

Tested by

no test coverage detected