(t *testing.T)
| 1266 | } |
| 1267 | |
| 1268 | func Test_ListCommits(t *testing.T) { |
| 1269 | // Verify tool definition once |
| 1270 | serverTool := ListCommits(translations.NullTranslationHelper) |
| 1271 | tool := serverTool.Tool |
| 1272 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 1273 | |
| 1274 | schema, ok := tool.InputSchema.(*jsonschema.Schema) |
| 1275 | require.True(t, ok, "InputSchema should be *jsonschema.Schema") |
| 1276 | |
| 1277 | assert.Equal(t, "list_commits", tool.Name) |
| 1278 | assert.NotEmpty(t, tool.Description) |
| 1279 | assert.Contains(t, schema.Properties, "owner") |
| 1280 | assert.Contains(t, schema.Properties, "repo") |
| 1281 | assert.Contains(t, schema.Properties, "sha") |
| 1282 | assert.Contains(t, schema.Properties, "author") |
| 1283 | assert.Contains(t, schema.Properties, "path") |
| 1284 | assert.Contains(t, schema.Properties, "since") |
| 1285 | assert.Contains(t, schema.Properties, "until") |
| 1286 | assert.Contains(t, schema.Properties, "page") |
| 1287 | assert.Contains(t, schema.Properties, "perPage") |
| 1288 | assert.ElementsMatch(t, schema.Required, []string{"owner", "repo"}) |
| 1289 | |
| 1290 | // Setup mock commits for success case |
| 1291 | mockCommits := []*github.RepositoryCommit{ |
| 1292 | { |
| 1293 | SHA: github.Ptr("abc123def456"), |
| 1294 | Commit: &github.Commit{ |
| 1295 | Message: github.Ptr("First commit"), |
| 1296 | Author: &github.CommitAuthor{ |
| 1297 | Name: github.Ptr("Test User"), |
| 1298 | Email: github.Ptr("test@example.com"), |
| 1299 | Date: &github.Timestamp{Time: time.Now().Add(-48 * time.Hour)}, |
| 1300 | }, |
| 1301 | }, |
| 1302 | Author: &github.User{ |
| 1303 | Login: github.Ptr("testuser"), |
| 1304 | ID: github.Ptr(int64(12345)), |
| 1305 | HTMLURL: github.Ptr("https://github.com/testuser"), |
| 1306 | AvatarURL: github.Ptr("https://github.com/testuser.png"), |
| 1307 | }, |
| 1308 | HTMLURL: github.Ptr("https://github.com/owner/repo/commit/abc123def456"), |
| 1309 | Stats: &github.CommitStats{ |
| 1310 | Additions: github.Ptr(10), |
| 1311 | Deletions: github.Ptr(5), |
| 1312 | Total: github.Ptr(15), |
| 1313 | }, |
| 1314 | Files: []*github.CommitFile{ |
| 1315 | { |
| 1316 | Filename: github.Ptr("src/main.go"), |
| 1317 | Status: github.Ptr("modified"), |
| 1318 | Additions: github.Ptr(8), |
| 1319 | Deletions: github.Ptr(3), |
| 1320 | Changes: github.Ptr(11), |
| 1321 | }, |
| 1322 | { |
| 1323 | Filename: github.Ptr("README.md"), |
| 1324 | Status: github.Ptr("added"), |
| 1325 | Additions: github.Ptr(2), |
nothing calls this directly
no test coverage detected