(t *testing.T)
| 2625 | } |
| 2626 | |
| 2627 | func TestInstallRun_TelemetryMultipleSkills(t *testing.T) { |
| 2628 | codeReviewContent := heredoc.Doc(` |
| 2629 | --- |
| 2630 | name: code-review |
| 2631 | description: Reviews code |
| 2632 | --- |
| 2633 | # Code Review |
| 2634 | `) |
| 2635 | |
| 2636 | reg := &httpmock.Registry{} |
| 2637 | defer reg.Verify(t) |
| 2638 | |
| 2639 | stubResolveVersion(reg, "monalisa", "octocat-skills", "v1.0.0", "abc123") |
| 2640 | treeJSON := `{"path": "skills/git-commit", "type": "tree", "sha": "treeGC"}, ` + |
| 2641 | `{"path": "skills/git-commit/SKILL.md", "type": "blob", "sha": "blobGC"}, ` + |
| 2642 | `{"path": "skills/code-review", "type": "tree", "sha": "treeCR"}, ` + |
| 2643 | `{"path": "skills/code-review/SKILL.md", "type": "blob", "sha": "blobCR"}` |
| 2644 | stubDiscoverTree(reg, "monalisa", "octocat-skills", "abc123", treeJSON) |
| 2645 | |
| 2646 | // Blob stubs for FetchDescriptionsConcurrent during interactive selection |
| 2647 | encGC := base64.StdEncoding.EncodeToString([]byte(gitCommitContent)) |
| 2648 | encCR := base64.StdEncoding.EncodeToString([]byte(codeReviewContent)) |
| 2649 | reg.Register( |
| 2650 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobGC"), |
| 2651 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobGC", "content": %q, "encoding": "base64"}`, encGC))) |
| 2652 | reg.Register( |
| 2653 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobCR"), |
| 2654 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobCR", "content": %q, "encoding": "base64"}`, encCR))) |
| 2655 | |
| 2656 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeGC", "blobGC", gitCommitContent) |
| 2657 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeCR", "blobCR", codeReviewContent) |
| 2658 | |
| 2659 | reg.Register( |
| 2660 | httpmock.REST("GET", "repos/monalisa/octocat-skills"), |
| 2661 | httpmock.JSONResponse(map[string]interface{}{ |
| 2662 | "visibility": "public", |
| 2663 | }), |
| 2664 | ) |
| 2665 | |
| 2666 | ios, _, _, _ := iostreams.Test() |
| 2667 | ios.SetStdoutTTY(true) |
| 2668 | ios.SetStdinTTY(true) |
| 2669 | |
| 2670 | pm := &prompter.PrompterMock{ |
| 2671 | MultiSelectWithSearchFunc: func(_, _ string, _, _ []string, _ func(string) prompter.MultiSelectSearchResult) ([]string, error) { |
| 2672 | return []string{allSkillsKey}, nil |
| 2673 | }, |
| 2674 | } |
| 2675 | |
| 2676 | recorder := &telemetry.EventRecorderSpy{} |
| 2677 | |
| 2678 | err := installRun(&InstallOptions{ |
| 2679 | IO: ios, |
| 2680 | HttpClient: func() (*http.Client, error) { return &http.Client{Transport: reg}, nil }, |
| 2681 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 2682 | Prompter: pm, |
| 2683 | SkillSource: "monalisa/octocat-skills", |
| 2684 | Agent: "github-copilot", |
nothing calls this directly
no test coverage detected