(t *testing.T)
| 1262 | } |
| 1263 | |
| 1264 | func Test_GetPullRequestCommits(t *testing.T) { |
| 1265 | // Verify tool definition once |
| 1266 | serverTool := PullRequestRead(translations.NullTranslationHelper) |
| 1267 | tool := serverTool.Tool |
| 1268 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 1269 | |
| 1270 | assert.Equal(t, "pull_request_read", tool.Name) |
| 1271 | assert.NotEmpty(t, tool.Description) |
| 1272 | schema := tool.InputSchema.(*jsonschema.Schema) |
| 1273 | assert.Contains(t, schema.Properties, "method") |
| 1274 | assert.Contains(t, schema.Properties, "owner") |
| 1275 | assert.Contains(t, schema.Properties, "repo") |
| 1276 | assert.Contains(t, schema.Properties, "pullNumber") |
| 1277 | assert.Contains(t, schema.Properties, "page") |
| 1278 | assert.Contains(t, schema.Properties, "perPage") |
| 1279 | assert.ElementsMatch(t, schema.Required, []string{"method", "owner", "repo", "pullNumber"}) |
| 1280 | |
| 1281 | authorDate := time.Date(2026, 4, 1, 12, 0, 0, 0, time.UTC) |
| 1282 | mockCommits := []*github.RepositoryCommit{ |
| 1283 | { |
| 1284 | SHA: github.Ptr("abc123def456"), |
| 1285 | HTMLURL: github.Ptr("https://github.com/owner/repo/commit/abc123def456"), |
| 1286 | Commit: &github.Commit{ |
| 1287 | Message: github.Ptr("feat: add commit listing"), |
| 1288 | Author: &github.CommitAuthor{ |
| 1289 | Name: github.Ptr("Test User"), |
| 1290 | Email: github.Ptr("test@example.com"), |
| 1291 | Date: &github.Timestamp{Time: authorDate}, |
| 1292 | }, |
| 1293 | Committer: &github.CommitAuthor{ |
| 1294 | Name: github.Ptr("Merge Bot"), |
| 1295 | Email: github.Ptr("merge@example.com"), |
| 1296 | Date: &github.Timestamp{Time: authorDate.Add(30 * time.Minute)}, |
| 1297 | }, |
| 1298 | }, |
| 1299 | Author: &github.User{ |
| 1300 | Login: github.Ptr("test-user"), |
| 1301 | ID: github.Ptr(int64(12345)), |
| 1302 | HTMLURL: github.Ptr("https://github.com/test-user"), |
| 1303 | AvatarURL: github.Ptr("https://github.com/test-user.png"), |
| 1304 | }, |
| 1305 | Committer: &github.User{ |
| 1306 | Login: github.Ptr("merge-bot"), |
| 1307 | ID: github.Ptr(int64(67890)), |
| 1308 | HTMLURL: github.Ptr("https://github.com/merge-bot"), |
| 1309 | AvatarURL: github.Ptr("https://github.com/merge-bot.png"), |
| 1310 | }, |
| 1311 | }, |
| 1312 | { |
| 1313 | SHA: github.Ptr("def456abc789"), |
| 1314 | HTMLURL: github.Ptr("https://github.com/owner/repo/commit/def456abc789"), |
| 1315 | Commit: &github.Commit{ |
| 1316 | Message: github.Ptr("fix: handle pagination"), |
| 1317 | }, |
| 1318 | }, |
| 1319 | } |
| 1320 | |
| 1321 | tests := []struct { |
nothing calls this directly
no test coverage detected