(t *testing.T)
| 2587 | } |
| 2588 | |
| 2589 | func TestInstallRun_TelemetryMultipleSkills(t *testing.T) { |
| 2590 | codeReviewContent := heredoc.Doc(` |
| 2591 | --- |
| 2592 | name: code-review |
| 2593 | description: Reviews code |
| 2594 | --- |
| 2595 | # Code Review |
| 2596 | `) |
| 2597 | |
| 2598 | reg := &httpmock.Registry{} |
| 2599 | defer reg.Verify(t) |
| 2600 | |
| 2601 | stubResolveVersion(reg, "monalisa", "octocat-skills", "v1.0.0", "abc123") |
| 2602 | treeJSON := `{"path": "skills/git-commit", "type": "tree", "sha": "treeGC"}, ` + |
| 2603 | `{"path": "skills/git-commit/SKILL.md", "type": "blob", "sha": "blobGC"}, ` + |
| 2604 | `{"path": "skills/code-review", "type": "tree", "sha": "treeCR"}, ` + |
| 2605 | `{"path": "skills/code-review/SKILL.md", "type": "blob", "sha": "blobCR"}` |
| 2606 | stubDiscoverTree(reg, "monalisa", "octocat-skills", "abc123", treeJSON) |
| 2607 | |
| 2608 | // Blob stubs for FetchDescriptionsConcurrent during interactive selection |
| 2609 | encGC := base64.StdEncoding.EncodeToString([]byte(gitCommitContent)) |
| 2610 | encCR := base64.StdEncoding.EncodeToString([]byte(codeReviewContent)) |
| 2611 | reg.Register( |
| 2612 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobGC"), |
| 2613 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobGC", "content": %q, "encoding": "base64"}`, encGC))) |
| 2614 | reg.Register( |
| 2615 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blobCR"), |
| 2616 | httpmock.StringResponse(fmt.Sprintf(`{"sha": "blobCR", "content": %q, "encoding": "base64"}`, encCR))) |
| 2617 | |
| 2618 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeGC", "blobGC", gitCommitContent) |
| 2619 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeCR", "blobCR", codeReviewContent) |
| 2620 | |
| 2621 | reg.Register( |
| 2622 | httpmock.REST("GET", "repos/monalisa/octocat-skills"), |
| 2623 | httpmock.JSONResponse(map[string]interface{}{ |
| 2624 | "visibility": "public", |
| 2625 | }), |
| 2626 | ) |
| 2627 | |
| 2628 | ios, _, _, _ := iostreams.Test() |
| 2629 | ios.SetStdoutTTY(true) |
| 2630 | ios.SetStdinTTY(true) |
| 2631 | |
| 2632 | pm := &prompter.PrompterMock{ |
| 2633 | MultiSelectWithSearchFunc: func(_, _ string, _, _ []string, _ func(string) prompter.MultiSelectSearchResult) ([]string, error) { |
| 2634 | return []string{allSkillsKey}, nil |
| 2635 | }, |
| 2636 | } |
| 2637 | |
| 2638 | recorder := &telemetry.EventRecorderSpy{} |
| 2639 | |
| 2640 | err := installRun(&InstallOptions{ |
| 2641 | IO: ios, |
| 2642 | HttpClient: func() (*http.Client, error) { return &http.Client{Transport: reg}, nil }, |
| 2643 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 2644 | Prompter: pm, |
| 2645 | SkillSource: "monalisa/octocat-skills", |
| 2646 | Agent: "github-copilot", |
nothing calls this directly
no test coverage detected