(t *testing.T)
| 983 | } |
| 984 | |
| 985 | func TestPreviewRun_TelemetryVisibility(t *testing.T) { |
| 986 | skillContent := heredoc.Doc(` |
| 987 | --- |
| 988 | name: my-skill |
| 989 | description: test |
| 990 | --- |
| 991 | # My Skill |
| 992 | Body. |
| 993 | `) |
| 994 | encodedContent := base64.StdEncoding.EncodeToString([]byte(skillContent)) |
| 995 | |
| 996 | tests := []struct { |
| 997 | name string |
| 998 | visibility string |
| 999 | visibilityErr bool |
| 1000 | wantSkillNames string |
| 1001 | }{ |
| 1002 | { |
| 1003 | name: "public repo includes skill names", |
| 1004 | visibility: "public", |
| 1005 | wantSkillNames: "my-skill", |
| 1006 | }, |
| 1007 | { |
| 1008 | name: "private repo excludes skill names", |
| 1009 | visibility: "private", |
| 1010 | }, |
| 1011 | { |
| 1012 | name: "internal repo excludes skill names", |
| 1013 | visibility: "internal", |
| 1014 | }, |
| 1015 | { |
| 1016 | name: "API error omits visibility and skill names", |
| 1017 | visibilityErr: true, |
| 1018 | }, |
| 1019 | } |
| 1020 | |
| 1021 | for _, tt := range tests { |
| 1022 | t.Run(tt.name, func(t *testing.T) { |
| 1023 | reg := &httpmock.Registry{} |
| 1024 | defer reg.Verify(t) |
| 1025 | |
| 1026 | reg.Register( |
| 1027 | httpmock.REST("GET", "repos/owner/repo/releases/latest"), |
| 1028 | httpmock.StringResponse(`{"tag_name": "v1.0.0"}`), |
| 1029 | ) |
| 1030 | reg.Register( |
| 1031 | httpmock.REST("GET", "repos/owner/repo/git/ref/tags/v1.0.0"), |
| 1032 | httpmock.StringResponse(`{"object": {"sha": "abc123", "type": "commit"}}`), |
| 1033 | ) |
| 1034 | reg.Register( |
| 1035 | httpmock.REST("GET", "repos/owner/repo/git/trees/abc123"), |
| 1036 | httpmock.StringResponse(`{ |
| 1037 | "sha": "abc123", |
| 1038 | "truncated": false, |
| 1039 | "tree": [ |
| 1040 | {"path": "skills/my-skill", "type": "tree", "sha": "treeSHA"}, |
| 1041 | {"path": "skills/my-skill/SKILL.md", "type": "blob", "sha": "blobSKILL"} |
| 1042 | ] |
nothing calls this directly
no test coverage detected