stubSkillByPath registers stubs for DiscoverSkillByPath (contents API + tree).
(reg *httpmock.Registry, owner, repo, sha, skillPath, skillName, treeSHA string)
| 248 | |
| 249 | // stubSkillByPath registers stubs for DiscoverSkillByPath (contents API + tree). |
| 250 | func stubSkillByPath(reg *httpmock.Registry, owner, repo, sha, skillPath, skillName, treeSHA string) { |
| 251 | parentPath := skillPath |
| 252 | if idx := strings.LastIndex(skillPath, "/"); idx >= 0 { |
| 253 | parentPath = skillPath[:idx] |
| 254 | } |
| 255 | reg.Register( |
| 256 | httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, url.PathEscape(parentPath))), |
| 257 | httpmock.StringResponse(fmt.Sprintf(`[{"name": %q, "path": %q, "sha": %q, "type": "dir"}]`, skillName, skillPath, treeSHA)), |
| 258 | ) |
| 259 | } |
| 260 | |
| 261 | // writeLocalTestSkill creates a skill directory with a SKILL.md file. |
| 262 | func writeLocalTestSkill(t *testing.T, baseDir, subPath, content string) { |
no test coverage detected