@@ -1619,45 +1619,35 @@ func Test_GetPullRequestComments(t *testing.T) {
16191619 },
16201620 expectError : false ,
16211621 validateResult : func (t * testing.T , textContent string ) {
1622- var result map [ string ] any
1622+ var result MinimalReviewThreadsResponse
16231623 err := json .Unmarshal ([]byte (textContent ), & result )
16241624 require .NoError (t , err )
16251625
1626- // Validate response structure
1627- assert .Contains (t , result , "reviewThreads" )
1628- assert .Contains (t , result , "pageInfo" )
1629- assert .Contains (t , result , "totalCount" )
1630-
16311626 // Validate review threads
1632- threads := result ["reviewThreads" ].([]any )
1633- assert .Len (t , threads , 1 )
1627+ assert .Len (t , result .ReviewThreads , 1 )
16341628
1635- thread := threads [0 ].(map [string ]any )
1636- assert .Equal (t , "RT_kwDOA0xdyM4AX1Yz" , thread ["ID" ])
1637- assert .Equal (t , false , thread ["IsResolved" ])
1638- assert .Equal (t , false , thread ["IsOutdated" ])
1639- assert .Equal (t , false , thread ["IsCollapsed" ])
1629+ thread := result .ReviewThreads [0 ]
1630+ assert .Equal (t , false , thread .IsResolved )
1631+ assert .Equal (t , false , thread .IsOutdated )
1632+ assert .Equal (t , false , thread .IsCollapsed )
16401633
16411634 // Validate comments within thread
1642- comments := thread ["Comments" ].(map [string ]any )
1643- commentNodes := comments ["Nodes" ].([]any )
1644- assert .Len (t , commentNodes , 2 )
1635+ assert .Len (t , thread .Comments , 2 )
16451636
16461637 // Validate first comment
1647- comment1 := commentNodes [0 ].( map [ string ] any )
1648- assert .Equal (t , "PRRC_kwDOA0xdyM4AX1Y0 " , comment1 [ "ID" ] )
1649- assert .Equal (t , "This looks good " , comment1 [ "Body" ] )
1650- assert .Equal (t , "file1.go " , comment1 [ "Path" ] )
1638+ comment1 := thread . Comments [0 ]
1639+ assert .Equal (t , "This looks good " , comment1 . Body )
1640+ assert .Equal (t , "file1.go " , comment1 . Path )
1641+ assert .Equal (t , "reviewer1 " , comment1 . Author )
16511642
16521643 // Validate pagination info
1653- pageInfo := result ["pageInfo" ].(map [string ]any )
1654- assert .Equal (t , false , pageInfo ["hasNextPage" ])
1655- assert .Equal (t , false , pageInfo ["hasPreviousPage" ])
1656- assert .Equal (t , "cursor1" , pageInfo ["startCursor" ])
1657- assert .Equal (t , "cursor2" , pageInfo ["endCursor" ])
1644+ assert .Equal (t , false , result .PageInfo .HasNextPage )
1645+ assert .Equal (t , false , result .PageInfo .HasPreviousPage )
1646+ assert .Equal (t , "cursor1" , result .PageInfo .StartCursor )
1647+ assert .Equal (t , "cursor2" , result .PageInfo .EndCursor )
16581648
16591649 // Validate total count
1660- assert .Equal (t , float64 ( 1 ) , result [ "totalCount" ] )
1650+ assert .Equal (t , 1 , result . TotalCount )
16611651 },
16621652 },
16631653 {
@@ -1761,27 +1751,22 @@ func Test_GetPullRequestComments(t *testing.T) {
17611751 expectError : false ,
17621752 lockdownEnabled : true ,
17631753 validateResult : func (t * testing.T , textContent string ) {
1764- var result map [ string ] any
1754+ var result MinimalReviewThreadsResponse
17651755 err := json .Unmarshal ([]byte (textContent ), & result )
17661756 require .NoError (t , err )
17671757
17681758 // Validate that only maintainer comment is returned
1769- threads := result ["reviewThreads" ].([]any )
1770- assert .Len (t , threads , 1 )
1759+ assert .Len (t , result .ReviewThreads , 1 )
17711760
1772- thread := threads [0 ].(map [string ]any )
1773- comments := thread ["Comments" ].(map [string ]any )
1761+ thread := result .ReviewThreads [0 ]
17741762
17751763 // Should only have 1 comment (maintainer) after filtering
1776- assert .Equal (t , float64 (1 ), comments ["TotalCount" ])
1777-
1778- commentNodes := comments ["Nodes" ].([]any )
1779- assert .Len (t , commentNodes , 1 )
1764+ assert .Equal (t , 1 , thread .TotalCount )
1765+ assert .Len (t , thread .Comments , 1 )
17801766
1781- comment := commentNodes [0 ].(map [string ]any )
1782- author := comment ["Author" ].(map [string ]any )
1783- assert .Equal (t , "maintainer" , author ["Login" ])
1784- assert .Equal (t , "Maintainer review comment" , comment ["Body" ])
1767+ comment := thread .Comments [0 ]
1768+ assert .Equal (t , "maintainer" , comment .Author )
1769+ assert .Equal (t , "Maintainer review comment" , comment .Body )
17851770 },
17861771 },
17871772 }
0 commit comments