@@ -76,6 +76,52 @@ func TestPullRequestsNewest(t *testing.T) {
7676	}
7777}
7878
79+ func  TestPullRequestsRecentClosed (t  * testing.T ) {
80+ 	assert .NoError (t , unittest .PrepareTestDatabase ())
81+ 	prs , _ , err  :=  issues_model .PullRequests (db .DefaultContext , 63 , & issues_model.PullRequestsOptions {
82+ 		ListOptions : db.ListOptions {
83+ 			Page : 1 ,
84+ 		},
85+ 		State :    "closed" ,
86+ 		SortType : "recentclose" ,
87+ 	})
88+ 	assert .NoError (t , err )
89+ 
90+ 	// Pull ID | Closed At.  | Updated At 
91+ 	//    11   | 1707270001  | 1707270001 
92+ 	//    12   | 1707271000  | 1707279999 
93+ 	//    13   | 1707279999  | 1707275555 
94+ 
95+ 	if  assert .Len (t , prs , 3 ) {
96+ 		assert .EqualValues (t , 13 , prs [0 ].ID )
97+ 		assert .EqualValues (t , 12 , prs [1 ].ID )
98+ 		assert .EqualValues (t , 11 , prs [2 ].ID )
99+ 	}
100+ }
101+ 
102+ func  TestPullRequestsRecentUpdate (t  * testing.T ) {
103+ 	assert .NoError (t , unittest .PrepareTestDatabase ())
104+ 	prs , _ , err  :=  issues_model .PullRequests (db .DefaultContext , 63 , & issues_model.PullRequestsOptions {
105+ 		ListOptions : db.ListOptions {
106+ 			Page : 1 ,
107+ 		},
108+ 		State :    "closed" ,
109+ 		SortType : "recentupdate" ,
110+ 	})
111+ 	assert .NoError (t , err )
112+ 
113+ 	// Pull ID | Closed At.  | Updated At 
114+ 	//    11   | 1707270001  | 1707270001 
115+ 	//    12   | 1707271000  | 1707279999 
116+ 	//    13   | 1707279999  | 1707275555 
117+ 
118+ 	if  assert .Len (t , prs , 3 ) {
119+ 		assert .EqualValues (t , 12 , prs [0 ].ID )
120+ 		assert .EqualValues (t , 13 , prs [1 ].ID )
121+ 		assert .EqualValues (t , 11 , prs [2 ].ID )
122+ 	}
123+ }
124+ 
79125func  TestLoadRequestedReviewers (t  * testing.T ) {
80126	assert .NoError (t , unittest .PrepareTestDatabase ())
81127
0 commit comments