(t *testing.T)
| 2656 | } |
| 2657 | |
| 2658 | func TestInstallRun_TelemetryMultipleSkills(t *testing.T) { |
| 2659 | codeReviewContent := heredoc.Doc(` |
| 2660 | --- |
| 2661 | name: code-review |
| 2662 | description: Reviews code |
| 2663 | --- |
| 2664 | # Code Review |
| 2665 | `) |
| 2666 | |
| 2667 | reg := &httpmock.Registry{} |
| 2668 | defer reg.Verify(t) |
| 2669 | |
| 2670 | stubResolveVersion(reg, "monalisa", "octocat-skills", "v1.0.0", "abc123") |
| 2671 | treeJSON := `{"path": "skills/git-commit", "type": "tree", "sha": "treeGC"}, ` + |
| 2672 | `{"path": "skills/git-commit/SKILL.md", "type": "blob", "sha": "blobGC"}, ` + |
| 2673 | `{"path": "skills/code-review", "type": "tree", "sha": "treeCR"}, ` + |
| 2674 | `{"path": "skills/code-review/SKILL.md", "type": "blob", "sha": "blobCR"}` |
| 2675 | stubDiscoverTree(reg, "monalisa", "octocat-skills", "abc123", treeJSON) |
| 2676 | |
| 2677 | // Blob stubs for FetchDescriptionsConcurrent during interactive selection |
| 2678 | encGC := base64.StdEncoding.EncodeToString([]byte(gitCommitContent)) |
| 2679 | encCR := base64.StdEncoding.EncodeToString([]byte(codeReviewContent)) |
| 2680 | reg.Register( |
| 2681 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobGC"), |
| 2682 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobGC", "content": %q, "encoding": "base64"}`, encGC))) |
| 2683 | reg.Register( |
| 2684 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobCR"), |
| 2685 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobCR", "content": %q, "encoding": "base64"}`, encCR))) |
| 2686 | |
| 2687 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeGC", "blobGC", gitCommitContent) |
| 2688 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeCR", "blobCR", codeReviewContent) |
| 2689 | |
| 2690 | reg.Register( |
| 2691 | httpmock.REST("GET", "repos/monalisa/octocat-skills"), |
| 2692 | httpmock.JSONResponse(map[string]any{ |
| 2693 | "visibility": "public", |
| 2694 | }), |
| 2695 | ) |
| 2696 | |
| 2697 | ios, _, _, _ := iostreams.Test() |
| 2698 | ios.SetStdoutTTY(true) |
| 2699 | ios.SetStdinTTY(true) |
| 2700 | |
| 2701 | pm := &prompter.PrompterMock{ |
| 2702 | MultiSelectWithSearchFunc: func(_, _ string, _, _ []string, _ func(string) prompter.MultiSelectSearchResult) ([]string, error) { |
| 2703 | return []string{allSkillsKey}, nil |
| 2704 | }, |
| 2705 | } |
| 2706 | |
| 2707 | recorder := &telemetry.EventRecorderSpy{} |
| 2708 | |
| 2709 | err := installRun(&InstallOptions{ |
| 2710 | IO: ios, |
| 2711 | HttpClient: func() (*http.Client, error) { return &http.Client{Transport: reg}, nil }, |
| 2712 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 2713 | Prompter: pm, |
| 2714 | SkillSource: "monalisa/octocat-skills", |
| 2715 | Agent: "github-copilot", |
nothing calls this directly
no test coverage detected