MCPcopy Create free account
hub / github.com/cli/cli / TestRunLocalInstall

Function TestRunLocalInstall

pkg/cmd/skills/install/install_test.go:1741–2289  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1739}
1740
1741func TestRunLocalInstall(t *testing.T) {
1742 tests := []struct {
1743 name string
1744 isTTY bool
1745 setup func(t *testing.T, sourceDir, targetDir string)
1746 opts func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions
1747 verify func(t *testing.T, targetDir string)
1748 wantErr string
1749 wantStdout string
1750 wantStderr string
1751 }{
1752 {
1753 name: "installs skill with local-path metadata",
1754 isTTY: false,
1755 setup: func(t *testing.T, sourceDir, _ string) {
1756 t.Helper()
1757 writeLocalTestSkill(t, sourceDir, filepath.Join("skills", "git-commit"), heredoc.Doc(`
1758 ---
1759 name: git-commit
1760 description: A local skill
1761 ---
1762 # Git Commit
1763 `))
1764 },
1765 opts: func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions {
1766 t.Helper()
1767 return &InstallOptions{
1768 IO: ios,
1769 SkillSource: sourceDir,
1770 localPath: sourceDir,
1771 SkillName: "git-commit",
1772 Force: true,
1773 Agent: "github-copilot",
1774 Scope: "project",
1775 ScopeChanged: true,
1776 Dir: targetDir,
1777 GitClient: &git.Client{RepoDir: t.TempDir()},
1778 }
1779 },
1780 verify: func(t *testing.T, targetDir string) {
1781 t.Helper()
1782 data, err := os.ReadFile(filepath.Join(targetDir, "git-commit", "SKILL.md"))
1783 require.NoError(t, err)
1784 assert.Contains(t, string(data), "local-path")
1785 },
1786 wantStdout: "Installed git-commit",
1787 },
1788 {
1789 name: "single skill directory (SKILL.md at root)",
1790 isTTY: false,
1791 setup: func(t *testing.T, sourceDir, _ string) {
1792 t.Helper()
1793 content := heredoc.Doc(`
1794 ---
1795 name: direct-skill
1796 description: Direct
1797 ---
1798 # Direct

Callers

nothing calls this directly

Calls 13

TestFunction · 0.92
writeLocalTestSkillFunction · 0.85
installRunFunction · 0.85
JoinMethod · 0.80
ContainsMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
verifyMethod · 0.80
HelperMethod · 0.65
RunMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected