seedMetadataDB populates the metadata index directly so CLI search/install tests don't depend on live GitHub downloads.
(t *testing.T, dbPath string)
| 13 | // seedMetadataDB populates the metadata index directly so CLI search/install |
| 14 | // tests don't depend on live GitHub downloads. |
| 15 | func 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 | |
| 33 | func TestMetadataRefreshCommand(t *testing.T) { |
| 34 | if testing.Short() || os.Getenv("CAM_RUN_LIVE_TESTS") != "1" { |
no test coverage detected