MCPcopy
hub / github.com/github/github-mcp-server / Test_GetCommit_Detail

Function Test_GetCommit_Detail

pkg/github/repositories_test.go:1154–1266  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1152}
1153
1154func 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,

Callers

nothing calls this directly

Calls 9

GetCommitFunction · 0.85
mockResponseFunction · 0.85
mustNewGHClientFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
getErrorResultFunction · 0.85
getTextResultFunction · 0.85
HandlerMethod · 0.45

Tested by

no test coverage detected