(t *testing.T)
| 1770 | } |
| 1771 | |
| 1772 | func TestRunLocalInstall(t *testing.T) { |
| 1773 | tests := []struct { |
| 1774 | name string |
| 1775 | isTTY bool |
| 1776 | setup func(t *testing.T, sourceDir, targetDir string) |
| 1777 | opts func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions |
| 1778 | verify func(t *testing.T, targetDir string) |
| 1779 | wantErr string |
| 1780 | wantStdout string |
| 1781 | wantStderr string |
| 1782 | }{ |
| 1783 | { |
| 1784 | name: "installs skill with local-path metadata", |
| 1785 | isTTY: false, |
| 1786 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1787 | t.Helper() |
| 1788 | writeLocalTestSkill(t, sourceDir, filepath.Join("skills", "git-commit"), heredoc.Doc(` |
| 1789 | --- |
| 1790 | name: git-commit |
| 1791 | description: A local skill |
| 1792 | --- |
| 1793 | # Git Commit |
| 1794 | `)) |
| 1795 | }, |
| 1796 | opts: func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions { |
| 1797 | t.Helper() |
| 1798 | return &InstallOptions{ |
| 1799 | IO: ios, |
| 1800 | SkillSource: sourceDir, |
| 1801 | localPath: sourceDir, |
| 1802 | SkillName: "git-commit", |
| 1803 | Force: true, |
| 1804 | Agent: "github-copilot", |
| 1805 | Scope: "project", |
| 1806 | ScopeChanged: true, |
| 1807 | Dir: targetDir, |
| 1808 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 1809 | } |
| 1810 | }, |
| 1811 | verify: func(t *testing.T, targetDir string) { |
| 1812 | t.Helper() |
| 1813 | data, err := os.ReadFile(filepath.Join(targetDir, "git-commit", "SKILL.md")) |
| 1814 | require.NoError(t, err) |
| 1815 | assert.Contains(t, string(data), "local-path") |
| 1816 | }, |
| 1817 | wantStdout: "Installed git-commit", |
| 1818 | }, |
| 1819 | { |
| 1820 | name: "single skill directory (SKILL.md at root)", |
| 1821 | isTTY: false, |
| 1822 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1823 | t.Helper() |
| 1824 | content := heredoc.Doc(` |
| 1825 | --- |
| 1826 | name: direct-skill |
| 1827 | description: Direct |
| 1828 | --- |
| 1829 | # Direct |
nothing calls this directly
no test coverage detected