@@ -2024,7 +2024,7 @@ func Test_GetPullRequestReviews(t *testing.T) {
20242024 },
20252025 }
20262026
2027- tests := []struct {
2027+ tests := []struct {
20282028 name string
20292029 mockedClient * http.Client
20302030 gqlHTTPClient * http.Client
@@ -2048,13 +2048,39 @@ func Test_GetPullRequestReviews(t *testing.T) {
20482048 expectError : false ,
20492049 expectedReviews : mockReviews ,
20502050 },
2051+ {
2052+ name : "successful reviews fetch with pagination" ,
2053+ mockedClient : MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
2054+ GetReposPullsReviewsByOwnerByRepoByPullNumber : expectQueryParams (t , map [string ]string {
2055+ "page" : "2" ,
2056+ "per_page" : "10" ,
2057+ }).andThen (
2058+ mockResponse (t , http .StatusOK , mockReviews ),
2059+ ),
2060+ }),
2061+ requestArgs : map [string ]any {
2062+ "method" : "get_reviews" ,
2063+ "owner" : "owner" ,
2064+ "repo" : "repo" ,
2065+ "pullNumber" : float64 (42 ),
2066+ "page" : float64 (2 ),
2067+ "perPage" : float64 (10 ),
2068+ },
2069+ expectError : false ,
2070+ expectedReviews : mockReviews ,
2071+ },
20512072 {
20522073 name : "reviews fetch fails" ,
20532074 mockedClient : MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
2054- GetReposPullsReviewsByOwnerByRepoByPullNumber : http .HandlerFunc (func (w http.ResponseWriter , _ * http.Request ) {
2055- w .WriteHeader (http .StatusNotFound )
2056- _ , _ = w .Write ([]byte (`{"message": "Not Found"}` ))
2057- }),
2075+ GetReposPullsReviewsByOwnerByRepoByPullNumber : expectQueryParams (t , map [string ]string {
2076+ "page" : "1" ,
2077+ "per_page" : "30" ,
2078+ }).andThen (
2079+ http .HandlerFunc (func (w http.ResponseWriter , _ * http.Request ) {
2080+ w .WriteHeader (http .StatusNotFound )
2081+ _ , _ = w .Write ([]byte (`{"message": "Not Found"}` ))
2082+ }),
2083+ ),
20582084 }),
20592085 requestArgs : map [string ]any {
20602086 "method" : "get_reviews" ,
0 commit comments