@@ -44,6 +44,7 @@ func TestDBSearchIssues(t *testing.T) {
44
44
t .Run ("search issues with order" , searchIssueWithOrder )
45
45
t .Run ("search issues in project" , searchIssueInProject )
46
46
t .Run ("search issues with paginator" , searchIssueWithPaginator )
47
+ t .Run ("search issues with any assignee" , searchIssueWithAnyAssignee )
47
48
}
48
49
49
50
func searchIssueWithKeyword (t * testing.T ) {
@@ -176,19 +177,19 @@ func searchIssueByID(t *testing.T) {
176
177
}{
177
178
{
178
179
opts : SearchOptions {
179
- PosterID : optional . Some ( int64 ( 1 )) ,
180
+ PosterID : "1" ,
180
181
},
181
182
expectedIDs : []int64 {11 , 6 , 3 , 2 , 1 },
182
183
},
183
184
{
184
185
opts : SearchOptions {
185
- AssigneeID : optional . Some ( int64 ( 1 )) ,
186
+ AssigneeID : "1" ,
186
187
},
187
188
expectedIDs : []int64 {6 , 1 },
188
189
},
189
190
{
190
- // NOTE: This tests no assignees filtering and also ToSearchOptions() to ensure it will set AssigneeID to 0 when it is passed as -1.
191
- opts : * ToSearchOptions ("" , & issues.IssuesOptions {AssigneeID : optional . Some ( db . NoConditionID ) }),
191
+ // NOTE: This tests no assignees filtering and also ToSearchOptions() to ensure it handles the filter correctly
192
+ opts : * ToSearchOptions ("" , & issues.IssuesOptions {AssigneeID : "(none)" }),
192
193
expectedIDs : []int64 {22 , 21 , 16 , 15 , 14 , 13 , 12 , 11 , 20 , 5 , 19 , 18 , 10 , 7 , 4 , 9 , 8 , 3 , 2 },
193
194
},
194
195
{
@@ -462,3 +463,25 @@ func searchIssueWithPaginator(t *testing.T) {
462
463
assert .Equal (t , test .expectedTotal , total )
463
464
}
464
465
}
466
+
467
+ func searchIssueWithAnyAssignee (t * testing.T ) {
468
+ tests := []struct {
469
+ opts SearchOptions
470
+ expectedIDs []int64
471
+ expectedTotal int64
472
+ }{
473
+ {
474
+ SearchOptions {
475
+ AssigneeID : "(any)" ,
476
+ },
477
+ []int64 {17 , 6 , 1 },
478
+ 3 ,
479
+ },
480
+ }
481
+ for _ , test := range tests {
482
+ issueIDs , total , err := SearchIssues (t .Context (), & test .opts )
483
+ require .NoError (t , err )
484
+ assert .Equal (t , test .expectedIDs , issueIDs )
485
+ assert .Equal (t , test .expectedTotal , total )
486
+ }
487
+ }
0 commit comments