(t *testing.T)
| 1855 | } |
| 1856 | |
| 1857 | func TestRunLocalInstall(t *testing.T) { |
| 1858 | tests := []struct { |
| 1859 | name string |
| 1860 | isTTY bool |
| 1861 | setup func(t *testing.T, sourceDir, targetDir string) |
| 1862 | opts func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions |
| 1863 | verify func(t *testing.T, targetDir string) |
| 1864 | wantErr string |
| 1865 | wantStdout string |
| 1866 | wantStderr string |
| 1867 | }{ |
| 1868 | { |
| 1869 | name: "installs skill with local-path metadata", |
| 1870 | isTTY: false, |
| 1871 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1872 | t.Helper() |
| 1873 | writeLocalTestSkill(t, sourceDir, filepath.Join("skills", "git-commit"), heredoc.Doc(` |
| 1874 | --- |
| 1875 | name: git-commit |
| 1876 | description: A local skill |
| 1877 | --- |
| 1878 | # Git Commit |
| 1879 | `)) |
| 1880 | }, |
| 1881 | opts: func(ios *iostreams.IOStreams, sourceDir, targetDir string) *InstallOptions { |
| 1882 | t.Helper() |
| 1883 | return &InstallOptions{ |
| 1884 | IO: ios, |
| 1885 | SkillSource: sourceDir, |
| 1886 | localPath: sourceDir, |
| 1887 | SkillName: "git-commit", |
| 1888 | Force: true, |
| 1889 | Agent: "github-copilot", |
| 1890 | Scope: "project", |
| 1891 | ScopeChanged: true, |
| 1892 | Dir: targetDir, |
| 1893 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 1894 | } |
| 1895 | }, |
| 1896 | verify: func(t *testing.T, targetDir string) { |
| 1897 | t.Helper() |
| 1898 | data, err := os.ReadFile(filepath.Join(targetDir, "git-commit", "SKILL.md")) |
| 1899 | require.NoError(t, err) |
| 1900 | assert.Contains(t, string(data), "local-path") |
| 1901 | }, |
| 1902 | wantStdout: "Installed git-commit", |
| 1903 | }, |
| 1904 | { |
| 1905 | name: "single skill directory (SKILL.md at root)", |
| 1906 | isTTY: false, |
| 1907 | setup: func(t *testing.T, sourceDir, _ string) { |
| 1908 | t.Helper() |
| 1909 | content := heredoc.Doc(` |
| 1910 | --- |
| 1911 | name: direct-skill |
| 1912 | description: Direct |
| 1913 | --- |
| 1914 | # Direct |
nothing calls this directly
no test coverage detected