(t *testing.T)
| 2689 | } |
| 2690 | |
| 2691 | func TestInstallRun_TelemetryVisibility(t *testing.T) { |
| 2692 | tests := []struct { |
| 2693 | name string |
| 2694 | visibility string |
| 2695 | wantUnknown bool |
| 2696 | wantSkillNames string |
| 2697 | }{ |
| 2698 | { |
| 2699 | name: "public repo includes skill names", |
| 2700 | visibility: "public", |
| 2701 | wantSkillNames: "git-commit", |
| 2702 | }, |
| 2703 | { |
| 2704 | name: "private repo excludes skill names", |
| 2705 | visibility: "private", |
| 2706 | }, |
| 2707 | { |
| 2708 | name: "internal repo excludes skill names", |
| 2709 | visibility: "internal", |
| 2710 | }, |
| 2711 | { |
| 2712 | name: "unrecognized visibility omits visibility and skill names", |
| 2713 | visibility: "unexpected", |
| 2714 | wantUnknown: true, |
| 2715 | }, |
| 2716 | } |
| 2717 | |
| 2718 | for _, tt := range tests { |
| 2719 | t.Run(tt.name, func(t *testing.T) { |
| 2720 | reg := &httpmock.Registry{} |
| 2721 | defer reg.Verify(t) |
| 2722 | |
| 2723 | stubRepository(reg, "monalisa", "octocat-skills", httpmock.JSONResponse(map[string]any{ |
| 2724 | "id": 1, |
| 2725 | "visibility": tt.visibility, |
| 2726 | })) |
| 2727 | stubResolveLatestTag(reg, "monalisa", "octocat-skills", "v1.0.0", "abc123") |
| 2728 | stubDiscoverTree(reg, "monalisa", "octocat-skills", "abc123", |
| 2729 | singleSkillTreeJSON("git-commit", "treeSHA", "blobSHA")) |
| 2730 | stubInstallFiles(reg, "monalisa", "octocat-skills", "treeSHA", "blobSHA", gitCommitContent) |
| 2731 | |
| 2732 | ios, _, _, _ := iostreams.Test() |
| 2733 | ios.SetStdoutTTY(true) |
| 2734 | ios.SetStdinTTY(true) |
| 2735 | |
| 2736 | recorder := &telemetry.EventRecorderSpy{} |
| 2737 | |
| 2738 | err := installRun(&InstallOptions{ |
| 2739 | IO: ios, |
| 2740 | HttpClient: func() (*http.Client, error) { return &http.Client{Transport: reg}, nil }, |
| 2741 | GitClient: &git.Client{RepoDir: t.TempDir()}, |
| 2742 | Prompter: &prompter.PrompterMock{}, |
| 2743 | SkillSource: "monalisa/octocat-skills", |
| 2744 | SkillName: "git-commit", |
| 2745 | Agent: "github-copilot", |
| 2746 | Scope: "project", |
| 2747 | ScopeChanged: true, |
| 2748 | Dir: t.TempDir(), |
nothing calls this directly
no test coverage detected