(t *testing.T)
| 1739 | } |
| 1740 | |
| 1741 | func 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 |
nothing calls this directly
no test coverage detected