@@ -12,6 +12,7 @@ import (
1212	"code.gitea.io/gitea/models/unittest" 
1313	"code.gitea.io/gitea/services/context" 
1414	"code.gitea.io/gitea/services/contexttest" 
15+ 
1516	"github.com/stretchr/testify/assert" 
1617)
1718
@@ -79,15 +80,15 @@ func TestListRunsExcludePullRequestsParam(t *testing.T) {
7980	ctx , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
8081	contexttest .LoadRepo (t , ctx , 1 )
8182	contexttest .LoadUser (t , ctx , 2 )
82- 	 
83+ 
8384	// Set up form value 
8485	setFormValue (ctx , "exclude_pull_requests" , "true" )
8586
8687	// Call the actual parsing logic from ListRuns 
8788	opts  :=  actions_model.FindRunOptions {
8889		RepoID : ctx .Repo .Repository .ID ,
8990	}
90- 	 
91+ 
9192	if  exclude  :=  ctx .FormString ("exclude_pull_requests" ); exclude  !=  ""  {
9293		if  exclude  ==  "true"  ||  exclude  ==  "1"  {
9394			opts .ExcludePullRequests  =  true 
@@ -101,13 +102,13 @@ func TestListRunsExcludePullRequestsParam(t *testing.T) {
101102	ctx2 , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
102103	contexttest .LoadRepo (t , ctx2 , 1 )
103104	contexttest .LoadUser (t , ctx2 , 2 )
104- 	 
105+ 
105106	setFormValue (ctx2 , "exclude_pull_requests" , "1" )
106107
107108	opts2  :=  actions_model.FindRunOptions {
108109		RepoID : ctx2 .Repo .Repository .ID ,
109110	}
110- 	 
111+ 
111112	if  exclude  :=  ctx2 .FormString ("exclude_pull_requests" ); exclude  !=  ""  {
112113		if  exclude  ==  "true"  ||  exclude  ==  "1"  {
113114			opts2 .ExcludePullRequests  =  true 
@@ -121,13 +122,13 @@ func TestListRunsExcludePullRequestsParam(t *testing.T) {
121122	ctx3 , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
122123	contexttest .LoadRepo (t , ctx3 , 1 )
123124	contexttest .LoadUser (t , ctx3 , 2 )
124- 	 
125+ 
125126	setFormValue (ctx3 , "exclude_pull_requests" , "false" )
126127
127128	opts3  :=  actions_model.FindRunOptions {
128129		RepoID : ctx3 .Repo .Repository .ID ,
129130	}
130- 	 
131+ 
131132	if  exclude  :=  ctx3 .FormString ("exclude_pull_requests" ); exclude  !=  ""  {
132133		if  exclude  ==  "true"  ||  exclude  ==  "1"  {
133134			opts3 .ExcludePullRequests  =  true 
@@ -144,19 +145,19 @@ func TestListRunsCheckSuiteIDParam(t *testing.T) {
144145	unittest .PrepareTestEnv (t )
145146
146147	const  testSuiteID  int64  =  12345 
147- 	 
148+ 
148149	// Test case: With check_suite_id parameter 
149150	ctx , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
150151	contexttest .LoadRepo (t , ctx , 1 )
151152	contexttest .LoadUser (t , ctx , 2 )
152- 	 
153+ 
153154	setFormValue (ctx , "check_suite_id" , "12345" )
154155
155156	// Call the actual parsing logic from ListRuns 
156157	opts  :=  actions_model.FindRunOptions {
157158		RepoID : ctx .Repo .Repository .ID ,
158159	}
159- 	 
160+ 
160161	// This simulates the logic in ListRuns 
161162	if  checkSuiteID  :=  ctx .FormInt64 ("check_suite_id" ); checkSuiteID  >  0  {
162163		opts .CheckSuiteID  =  checkSuiteID 
@@ -175,20 +176,20 @@ func TestListRunsCreatedParam(t *testing.T) {
175176	ctx , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
176177	contexttest .LoadRepo (t , ctx , 1 )
177178	contexttest .LoadUser (t , ctx , 2 )
178- 	 
179+ 
179180	setFormValue (ctx , "created" , "2023-01-01..2023-12-31" )
180181
181182	opts  :=  actions_model.FindRunOptions {
182183		RepoID : ctx .Repo .Repository .ID ,
183184	}
184- 	 
185+ 
185186	// Simulate the date parsing logic from ListRuns 
186187	if  created  :=  ctx .FormString ("created" ); created  !=  ""  {
187188		if  created  ==  "2023-01-01..2023-12-31"  {
188189			startDate , _  :=  time .Parse ("2006-01-02" , "2023-01-01" )
189190			endDate , _  :=  time .Parse ("2006-01-02" , "2023-12-31" )
190191			endDate  =  endDate .Add (24 * time .Hour  -  time .Second )
191- 			 
192+ 
192193			opts .CreatedAfter  =  startDate 
193194			opts .CreatedBefore  =  endDate 
194195		}
@@ -198,21 +199,21 @@ func TestListRunsCreatedParam(t *testing.T) {
198199	expectedStart , _  :=  time .Parse ("2006-01-02" , "2023-01-01" )
199200	expectedEnd , _  :=  time .Parse ("2006-01-02" , "2023-12-31" )
200201	expectedEnd  =  expectedEnd .Add (24 * time .Hour  -  time .Second )
201- 	 
202+ 
202203	assert .Equal (t , expectedStart , opts .CreatedAfter )
203204	assert .Equal (t , expectedEnd , opts .CreatedBefore )
204205
205206	// Test case 2: With created in ">=" format 
206207	ctx2 , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
207208	contexttest .LoadRepo (t , ctx2 , 1 )
208209	contexttest .LoadUser (t , ctx2 , 2 )
209- 	 
210+ 
210211	setFormValue (ctx2 , "created" , ">=2023-01-01" )
211212
212213	opts2  :=  actions_model.FindRunOptions {
213214		RepoID : ctx2 .Repo .Repository .ID ,
214215	}
215- 	 
216+ 
216217	// Simulate the date parsing logic for >= format 
217218	if  created  :=  ctx2 .FormString ("created" ); created  !=  ""  {
218219		if  created  ==  ">=2023-01-01"  {
@@ -231,13 +232,13 @@ func TestListRunsCreatedParam(t *testing.T) {
231232	ctx3 , _  :=  contexttest .MockAPIContext (t , "user2/repo1" )
232233	contexttest .LoadRepo (t , ctx3 , 1 )
233234	contexttest .LoadUser (t , ctx3 , 2 )
234- 	 
235+ 
235236	setFormValue (ctx3 , "created" , "2023-06-15" )
236237
237238	opts3  :=  actions_model.FindRunOptions {
238239		RepoID : ctx3 .Repo .Repository .ID ,
239240	}
240- 	 
241+ 
241242	// Simulate the date parsing logic for exact date 
242243	if  created  :=  ctx3 .FormString ("created" ); created  !=  ""  {
243244		if  created  ==  "2023-06-15"  {
0 commit comments