(t *testing.T)
| 2784 | } |
| 2785 | |
| 2786 | func TestInstallRun_TelemetryMultipleSkills(t *testing.T) { |
| 2787 | codeReviewContent := heredoc.Doc(` |
| 2788 | --- |
| 2789 | name: code-review |
| 2790 | description: Reviews code |
| 2791 | --- |
| 2792 | # Code Review |
| 2793 | `) |
| 2794 | |
| 2795 | reg := &httpmock.Registry{} |
| 2796 | defer reg.Verify(t) |
| 2797 | |
| 2798 | stubRepository(reg, "monalisa", "octocat-skills", httpmock.JSONResponse(map[string]any{ |
| 2799 | "id": 1, |
| 2800 | "visibility": "public", |
| 2801 | })) |
| 2802 | stubResolveLatestTag(reg, "monalisa", "octocat-skills", "v1.0.0", "abc123") |
| 2803 | treeJSON := `{"path": "skills/git-commit", "type": "tree", "sha": "treeGC"}, ` + |
| 2804 | `{"path": "skills/git-commit/SKILL.md", "type": "blob", "sha": "blobGC"}, ` + |
| 2805 | `{"path": "skills/code-review", "type": "tree", "sha": "treeCR"}, ` + |
| 2806 | `{"path": "skills/code-review/SKILL.md", "type": "blob", "sha": "blobCR"}` |
| 2807 | stubDiscoverTree(reg, "monalisa", "octocat-skills", "abc123", treeJSON) |
| 2808 | |
| 2809 | // Blob stubs for FetchDescriptionsConcurrent during interactive selection |
| 2810 | encGC := base64.StdEncoding.EncodeToString([]byte(gitCommitContent)) |
| 2811 | encCR := base64.StdEncoding.EncodeToString([]byte(codeReviewContent)) |
| 2812 | reg.Register( |
| 2813 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobGC"), |
| 2814 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobGC", "content": %q, "encoding": "base64"}`, encGC))) |
| 2815 | reg.Register( |
| 2816 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobCR"), |
| 2817 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobCR", "content": %q, "encoding": "base64"}`, encCR))) |
| 2818 | |
| 2819 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeGC", "blobGC", gitCommitContent) |
| 2820 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeCR", "blobCR", codeReviewContent) |
| 2821 | |
| 2822 | ios, _, _, _ := iostreams.Test() |
| 2823 | ios.SetStdoutTTY(true) |
| 2824 | ios.SetStdinTTY(true) |
| 2825 | |
| 2826 | pm := &prompter.PrompterMock{ |
| 2827 | MultiSelectWithSearchFunc: func(_, _ string, _, _ []string, _ func(string) prompter.MultiSelectSearchResult) ([]string, error) { |
| 2828 | return []string{allSkillsKey}, nil |
| 2829 | }, |
| 2830 | } |
| 2831 | |
| 2832 | recorder := &telemetry.EventRecorderSpy{} |
| 2833 | |
| 2834 | err := installRun(&InstallOptions{ |
| 2835 | IO: ios, |
| 2836 | HttpClient: func() (*http.Client, error) { return &http.Client{Transport: reg}, nil }, |
| 2837 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 2838 | Prompter: pm, |
| 2839 | SkillSource: "monalisa/octocat-skills", |
| 2840 | Agent: "github-copilot", |
| 2841 | Scope: "project", |
| 2842 | ScopeChanged: true, |
| 2843 | Dir: t.TempDir(), |
nothing calls this directly
no test coverage detected