(t *testing.T)
| 1152 | } |
| 1153 | |
| 1154 | func Test_GetCommit_Detail(t *testing.T) { |
| 1155 | mockCommit := &github.RepositoryCommit{ |
| 1156 | SHA: github.Ptr("abc123def456"), |
| 1157 | HTMLURL: github.Ptr("https://github.com/owner/repo/commit/abc123def456"), |
| 1158 | Commit: &github.Commit{ |
| 1159 | Message: github.Ptr("First commit"), |
| 1160 | }, |
| 1161 | Stats: &github.CommitStats{ |
| 1162 | Additions: github.Ptr(10), |
| 1163 | Deletions: github.Ptr(2), |
| 1164 | Total: github.Ptr(12), |
| 1165 | }, |
| 1166 | Files: []*github.CommitFile{ |
| 1167 | { |
| 1168 | Filename: github.Ptr("file1.go"), |
| 1169 | Status: github.Ptr("modified"), |
| 1170 | Additions: github.Ptr(10), |
| 1171 | Deletions: github.Ptr(2), |
| 1172 | Changes: github.Ptr(12), |
| 1173 | Patch: github.Ptr("@@ -1,2 +1,10 @@\n+new line"), |
| 1174 | }, |
| 1175 | }, |
| 1176 | } |
| 1177 | |
| 1178 | cases := []struct { |
| 1179 | name string |
| 1180 | args map[string]any |
| 1181 | expectFiles bool |
| 1182 | expectStats bool |
| 1183 | expectPatch bool |
| 1184 | expectError string |
| 1185 | }{ |
| 1186 | { |
| 1187 | name: "default returns stats", |
| 1188 | args: map[string]any{"owner": "owner", "repo": "repo", "sha": "abc123def456"}, |
| 1189 | expectFiles: true, |
| 1190 | expectStats: true, |
| 1191 | expectPatch: false, |
| 1192 | }, |
| 1193 | { |
| 1194 | name: "detail=none omits stats and files", |
| 1195 | args: map[string]any{"owner": "owner", "repo": "repo", "sha": "abc123def456", "detail": "none"}, |
| 1196 | expectFiles: false, |
| 1197 | expectStats: false, |
| 1198 | expectPatch: false, |
| 1199 | }, |
| 1200 | { |
| 1201 | name: "detail=stats returns metadata without patch", |
| 1202 | args: map[string]any{"owner": "owner", "repo": "repo", "sha": "abc123def456", "detail": "stats"}, |
| 1203 | expectFiles: true, |
| 1204 | expectStats: true, |
| 1205 | expectPatch: false, |
| 1206 | }, |
| 1207 | { |
| 1208 | name: "detail=full_patch includes patch text", |
| 1209 | args: map[string]any{"owner": "owner", "repo": "repo", "sha": "abc123def456", "detail": "full_patch"}, |
| 1210 | expectFiles: true, |
| 1211 | expectStats: true, |
nothing calls this directly
no test coverage detected