@@ -335,18 +335,13 @@ func Test_SearchUsers(t *testing.T) {
335335 ID : github .Ptr (int64 (1001 )),
336336 HTMLURL : github .Ptr ("https://github.com/user1" ),
337337 AvatarURL : github .Ptr ("https://avatars.githubusercontent.com/u/1001" ),
338- Type : github .Ptr ("User" ),
339- Followers : github .Ptr (100 ),
340- Following : github .Ptr (50 ),
341338 },
342339 {
343340 Login : github .Ptr ("user2" ),
344341 ID : github .Ptr (int64 (1002 )),
345342 HTMLURL : github .Ptr ("https://github.com/user2" ),
346343 AvatarURL : github .Ptr ("https://avatars.githubusercontent.com/u/1002" ),
347344 Type : github .Ptr ("User" ),
348- Followers : github .Ptr (200 ),
349- Following : github .Ptr (75 ),
350345 },
351346 },
352347 }
@@ -365,7 +360,7 @@ func Test_SearchUsers(t *testing.T) {
365360 mock .WithRequestMatchHandler (
366361 mock .GetSearchUsers ,
367362 expectQueryParams (t , map [string ]string {
368- "q" : "location:finland language:go" ,
363+ "q" : "type:user location:finland language:go" ,
369364 "sort" : "followers" ,
370365 "order" : "desc" ,
371366 "page" : "1" ,
@@ -391,7 +386,7 @@ func Test_SearchUsers(t *testing.T) {
391386 mock .WithRequestMatchHandler (
392387 mock .GetSearchUsers ,
393388 expectQueryParams (t , map [string ]string {
394- "q" : "location:finland language:go" ,
389+ "q" : "type:user location:finland language:go" ,
395390 "page" : "1" ,
396391 "per_page" : "30" ,
397392 }).andThen (
@@ -451,19 +446,17 @@ func Test_SearchUsers(t *testing.T) {
451446 textContent := getTextResult (t , result )
452447
453448 // Unmarshal and verify the result
454- var returnedResult github. UsersSearchResult
449+ var returnedResult MinimalSearchUsersResult
455450 err = json .Unmarshal ([]byte (textContent .Text ), & returnedResult )
456451 require .NoError (t , err )
457- assert .Equal (t , * tc .expectedResult .Total , * returnedResult .Total )
458- assert .Equal (t , * tc .expectedResult .IncompleteResults , * returnedResult .IncompleteResults )
459- assert .Len (t , returnedResult .Users , len (tc .expectedResult .Users ))
460- for i , user := range returnedResult .Users {
461- assert .Equal (t , * tc .expectedResult .Users [i ].Login , * user .Login )
462- assert .Equal (t , * tc .expectedResult .Users [i ].ID , * user .ID )
463- assert .Equal (t , * tc .expectedResult .Users [i ].HTMLURL , * user .HTMLURL )
464- assert .Equal (t , * tc .expectedResult .Users [i ].AvatarURL , * user .AvatarURL )
465- assert .Equal (t , * tc .expectedResult .Users [i ].Type , * user .Type )
466- assert .Equal (t , * tc .expectedResult .Users [i ].Followers , * user .Followers )
452+ assert .Equal (t , * tc .expectedResult .Total , returnedResult .TotalCount )
453+ assert .Equal (t , * tc .expectedResult .IncompleteResults , returnedResult .IncompleteResults )
454+ assert .Len (t , returnedResult .Items , len (tc .expectedResult .Users ))
455+ for i , user := range returnedResult .Items {
456+ assert .Equal (t , * tc .expectedResult .Users [i ].Login , user .Login )
457+ assert .Equal (t , * tc .expectedResult .Users [i ].ID , user .ID )
458+ assert .Equal (t , * tc .expectedResult .Users [i ].HTMLURL , user .ProfileURL )
459+ assert .Equal (t , * tc .expectedResult .Users [i ].AvatarURL , user .AvatarURL )
467460 }
468461 })
469462 }
0 commit comments