@@ -410,6 +410,46 @@ func Test_SearchUsers(t *testing.T) {
410410 expectError : false ,
411411 expectedResult : mockSearchResult ,
412412 },
413+ {
414+ name : "query with existing type:user filter - no duplication" ,
415+ mockedClient : mock .NewMockedHTTPClient (
416+ mock .WithRequestMatchHandler (
417+ mock .GetSearchUsers ,
418+ expectQueryParams (t , map [string ]string {
419+ "q" : "type:user location:seattle followers:>100" ,
420+ "page" : "1" ,
421+ "per_page" : "30" ,
422+ }).andThen (
423+ mockResponse (t , http .StatusOK , mockSearchResult ),
424+ ),
425+ ),
426+ ),
427+ requestArgs : map [string ]interface {}{
428+ "query" : "type:user location:seattle followers:>100" ,
429+ },
430+ expectError : false ,
431+ expectedResult : mockSearchResult ,
432+ },
433+ {
434+ name : "complex query with existing type:user filter and OR operators" ,
435+ mockedClient : mock .NewMockedHTTPClient (
436+ mock .WithRequestMatchHandler (
437+ mock .GetSearchUsers ,
438+ expectQueryParams (t , map [string ]string {
439+ "q" : "type:user (location:seattle OR location:california) followers:>50" ,
440+ "page" : "1" ,
441+ "per_page" : "30" ,
442+ }).andThen (
443+ mockResponse (t , http .StatusOK , mockSearchResult ),
444+ ),
445+ ),
446+ ),
447+ requestArgs : map [string ]interface {}{
448+ "query" : "type:user (location:seattle OR location:california) followers:>50" ,
449+ },
450+ expectError : false ,
451+ expectedResult : mockSearchResult ,
452+ },
413453 {
414454 name : "search users fails" ,
415455 mockedClient : mock .NewMockedHTTPClient (
@@ -537,6 +577,46 @@ func Test_SearchOrgs(t *testing.T) {
537577 expectError : false ,
538578 expectedResult : mockSearchResult ,
539579 },
580+ {
581+ name : "query with existing type:org filter - no duplication" ,
582+ mockedClient : mock .NewMockedHTTPClient (
583+ mock .WithRequestMatchHandler (
584+ mock .GetSearchUsers ,
585+ expectQueryParams (t , map [string ]string {
586+ "q" : "type:org location:california followers:>1000" ,
587+ "page" : "1" ,
588+ "per_page" : "30" ,
589+ }).andThen (
590+ mockResponse (t , http .StatusOK , mockSearchResult ),
591+ ),
592+ ),
593+ ),
594+ requestArgs : map [string ]interface {}{
595+ "query" : "type:org location:california followers:>1000" ,
596+ },
597+ expectError : false ,
598+ expectedResult : mockSearchResult ,
599+ },
600+ {
601+ name : "complex query with existing type:org filter and OR operators" ,
602+ mockedClient : mock .NewMockedHTTPClient (
603+ mock .WithRequestMatchHandler (
604+ mock .GetSearchUsers ,
605+ expectQueryParams (t , map [string ]string {
606+ "q" : "type:org (location:seattle OR location:california OR location:newyork) repos:>10" ,
607+ "page" : "1" ,
608+ "per_page" : "30" ,
609+ }).andThen (
610+ mockResponse (t , http .StatusOK , mockSearchResult ),
611+ ),
612+ ),
613+ ),
614+ requestArgs : map [string ]interface {}{
615+ "query" : "type:org (location:seattle OR location:california OR location:newyork) repos:>10" ,
616+ },
617+ expectError : false ,
618+ expectedResult : mockSearchResult ,
619+ },
540620 {
541621 name : "org search fails" ,
542622 mockedClient : mock .NewMockedHTTPClient (
0 commit comments