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