File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 165165 owner_id : 14
166166 lower_name : test_repo_14
167167 name : test_repo_14
168+ description : test_description_14
168169 is_private : false
169170 num_issues : 0
170171 num_closed_issues : 0
Original file line number Diff line number Diff line change @@ -74,6 +74,34 @@ func TestSearchRepositoryByName(t *testing.T) {
7474 assert .Empty (t , repos )
7575 assert .Equal (t , int64 (0 ), count )
7676
77+ // Test search within description
78+ repos , count , err = SearchRepository (& SearchRepoOptions {
79+ Keyword : "description_14" ,
80+ Page : 1 ,
81+ PageSize : 10 ,
82+ Collaborate : util .OptionalBoolFalse ,
83+ IncludeDescription : true ,
84+ })
85+
86+ assert .NoError (t , err )
87+ if assert .Len (t , repos , 1 ) {
88+ assert .Equal (t , "test_repo_14" , repos [0 ].Name )
89+ }
90+ assert .Equal (t , int64 (1 ), count )
91+
92+ // Test NOT search within description
93+ repos , count , err = SearchRepository (& SearchRepoOptions {
94+ Keyword : "description_14" ,
95+ Page : 1 ,
96+ PageSize : 10 ,
97+ Collaborate : util .OptionalBoolFalse ,
98+ IncludeDescription : false ,
99+ })
100+
101+ assert .NoError (t , err )
102+ assert .Empty (t , repos )
103+ assert .Equal (t , int64 (0 ), count )
104+
77105 testCases := []struct {
78106 name string
79107 opts * SearchRepoOptions
You can’t perform that action at this time.
0 commit comments