(t *testing.T)
| 1083 | } |
| 1084 | |
| 1085 | func TestDiscoverSkillByPath(t *testing.T) { |
| 1086 | tests := []struct { |
| 1087 | name string |
| 1088 | skillPath string |
| 1089 | stubs func(*httpmock.Registry) |
| 1090 | wantName string |
| 1091 | wantNS string |
| 1092 | wantConvention string |
| 1093 | wantErr string |
| 1094 | }{ |
| 1095 | { |
| 1096 | name: "discovers skill by path", |
| 1097 | skillPath: "skills/code-review", |
| 1098 | stubs: func(reg *httpmock.Registry) { |
| 1099 | reg.Register( |
| 1100 | httpmock.REST("GET", "repos/monalisa/octocat-skills/contents/skills"), |
| 1101 | httpmock.JSONResponse([]map[string]interface{}{ |
| 1102 | {"name": "code-review", "path": "skills/code-review", "sha": "tree-sha", "type": "dir"}, |
| 1103 | })) |
| 1104 | reg.Register( |
| 1105 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/trees/tree-sha"), |
| 1106 | httpmock.JSONResponse(map[string]interface{}{ |
| 1107 | "sha": "tree-sha", "truncated": false, |
| 1108 | "tree": []map[string]interface{}{ |
| 1109 | {"path": "SKILL.md", "type": "blob", "sha": "blob-sha"}, |
| 1110 | }, |
| 1111 | })) |
| 1112 | reg.Register( |
| 1113 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blob-sha"), |
| 1114 | httpmock.JSONResponse(map[string]interface{}{ |
| 1115 | "sha": "blob-sha", "encoding": "base64", "content": "IyBTa2lsbA==", |
| 1116 | })) |
| 1117 | }, |
| 1118 | wantName: "code-review", |
| 1119 | }, |
| 1120 | { |
| 1121 | name: "namespaced path sets namespace", |
| 1122 | skillPath: "skills/monalisa/issue-triage", |
| 1123 | stubs: func(reg *httpmock.Registry) { |
| 1124 | reg.Register( |
| 1125 | httpmock.REST("GET", "repos/monalisa/octocat-skills/contents/skills%2Fmonalisa"), |
| 1126 | httpmock.JSONResponse([]map[string]interface{}{ |
| 1127 | {"name": "issue-triage", "path": "skills/monalisa/issue-triage", "sha": "tree-sha", "type": "dir"}, |
| 1128 | })) |
| 1129 | reg.Register( |
| 1130 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/trees/tree-sha"), |
| 1131 | httpmock.JSONResponse(map[string]interface{}{ |
| 1132 | "sha": "tree-sha", "truncated": false, |
| 1133 | "tree": []map[string]interface{}{ |
| 1134 | {"path": "SKILL.md", "type": "blob", "sha": "blob-sha"}, |
| 1135 | }, |
| 1136 | })) |
| 1137 | reg.Register( |
| 1138 | httpmock.REST("GET", "repos/monalisa/octocat-skills/git/blobs/blob-sha"), |
| 1139 | httpmock.JSONResponse(map[string]interface{}{ |
| 1140 | "sha": "blob-sha", "encoding": "base64", "content": "IyBTa2lsbA==", |
| 1141 | })) |
| 1142 | }, |
nothing calls this directly
no test coverage detected