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