MCPcopy
hub / github.com/cli/cli / TestInjectGitHubMetadata

Function TestInjectGitHubMetadata

internal/skills/frontmatter/frontmatter_test.go:66–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestInjectGitHubMetadata(t *testing.T) {
67 tests := []struct {
68 name string
69 content string
70 host string
71 owner string
72 repo string
73 ref string
74 treeSHA string
75 pinnedRef string
76 skillPath string
77 wantContains []string
78 wantNotContain []string
79 }{
80 {
81 name: "injects metadata without pin",
82 content: heredoc.Doc(`
83 ---
84 name: my-skill
85 description: desc
86 ---
87 # Body
88 `),
89 host: "github.com",
90 owner: "monalisa",
91 repo: "octocat-skills",
92 ref: "refs/tags/v1.0.0",
93 treeSHA: "tree456",
94 pinnedRef: "",
95 skillPath: "skills/my-skill",
96 wantContains: []string{
97 "github-repo: https://github.com/monalisa/octocat-skills",
98 "github-ref: refs/tags/v1.0.0",
99 "github-tree-sha: tree456",
100 "github-path: skills/my-skill",
101 "# Body",
102 },
103 wantNotContain: []string{
104 "github-owner",
105 "github-sha",
106 "github-pinned",
107 },
108 },
109 {
110 name: "injects pinned ref",
111 content: heredoc.Doc(`
112 ---
113 name: my-skill
114 ---
115 # Body
116 `),
117 host: "github.com",
118 owner: "monalisa",
119 repo: "octocat-skills",
120 ref: "refs/tags/v1.0.0",
121 treeSHA: "tree",
122 pinnedRef: "v1.0.0",
123 skillPath: "skills/my-skill",

Callers

nothing calls this directly

Calls 3

InjectGitHubMetadataFunction · 0.85
ContainsMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected