File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 165
165
owner_id : 14
166
166
lower_name : test_repo_14
167
167
name : test_repo_14
168
+ description : test_description_14
168
169
is_private : false
169
170
num_issues : 0
170
171
num_closed_issues : 0
Original file line number Diff line number Diff line change @@ -74,6 +74,34 @@ func TestSearchRepositoryByName(t *testing.T) {
74
74
assert .Empty (t , repos )
75
75
assert .Equal (t , int64 (0 ), count )
76
76
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
+
77
105
testCases := []struct {
78
106
name string
79
107
opts * SearchRepoOptions
You can’t perform that action at this time.
0 commit comments