(t *testing.T)
| 1714 | } |
| 1715 | |
| 1716 | func TestRunLocalInstall(t *testing.T) { |
| 1717 | tests := []struct { |
| 1718 | name string |
| 1719 | isTTY bool |
| 1720 | setup func(t *testing.T, sourceDir, targetDir string) |
| 1721 | opts func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions |
| 1722 | verify func(t *testing.T, targetDir string) |
| 1723 | wantErr string |
| 1724 | wantStdout string |
| 1725 | wantStderr string |
| 1726 | }{ |
| 1727 | { |
| 1728 | name: "installs skill with local-path metadata", |
| 1729 | isTTY: false, |
| 1730 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1731 | t.Helper() |
| 1732 | writeLocalTestSkill(t, sourceDir, filepath.Join("skills", "git-commit"), heredoc.Doc(` |
| 1733 | --- |
| 1734 | name: git-commit |
| 1735 | description: A local skill |
| 1736 | --- |
| 1737 | # Git Commit |
| 1738 | `)) |
| 1739 | }, |
| 1740 | opts: func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions { |
| 1741 | t.Helper() |
| 1742 | return &InstallOptions{ |
| 1743 | IO: ios, |
| 1744 | SkillSource: sourceDir, |
| 1745 | localPath: sourceDir, |
| 1746 | SkillName: "git-commit", |
| 1747 | Force: true, |
| 1748 | Agent: "github-copilot", |
| 1749 | Scope: "project", |
| 1750 | ScopeChanged: true, |
| 1751 | Dir: targetDir, |
| 1752 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 1753 | } |
| 1754 | }, |
| 1755 | verify: func(t *testing.T, targetDir string) { |
| 1756 | t.Helper() |
| 1757 | data, err := os.ReadFile(filepath.Join(targetDir, "git-commit", "SKILL.md")) |
| 1758 | require.NoError(t, err) |
| 1759 | assert.Contains(t, string(data), "local-path") |
| 1760 | }, |
| 1761 | wantStdout: "Installed git-commit", |
| 1762 | }, |
| 1763 | { |
| 1764 | name: "single skill directory (SKILL.md at root)", |
| 1765 | isTTY: false, |
| 1766 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1767 | t.Helper() |
| 1768 | content := heredoc.Doc(` |
| 1769 | --- |
| 1770 | name: direct-skill |
| 1771 | description: Direct |
| 1772 | --- |
| 1773 | # Direct |
nothing calls this directly
no test coverage detected