@@ -69,7 +69,6 @@ test("Return empty array if not issues found", async (t) => {
69
69
const repo = "test_repo" ;
70
70
const title = "The automated release is failing 🚨" ;
71
71
const labels = [ ] ;
72
- const issues = [ ] ;
73
72
const fetch = fetchMock
74
73
. sandbox ( )
75
74
. postOnce ( "https://api.github.local/graphql" , {
@@ -78,15 +77,7 @@ test("Return empty array if not issues found", async (t) => {
78
77
issues : { nodes : [ ] } ,
79
78
} ,
80
79
} ,
81
- } )
82
- . getOnce (
83
- `https://api.github.local/search/issues?q=${ encodeURIComponent (
84
- "in:title" ,
85
- ) } +${ encodeURIComponent ( `repo:${ owner } /${ repo } ` ) } +${ encodeURIComponent (
86
- "type:issue" ,
87
- ) } +${ encodeURIComponent ( "state:open" ) } +${ encodeURIComponent ( title ) } `,
88
- { items : issues } ,
89
- ) ;
80
+ } ) ;
90
81
91
82
const srIssues = await findSRIssues (
92
83
new TestOctokit ( { request : { fetch } } ) ,
@@ -133,84 +124,3 @@ test("Return empty array if not issues has matching ID", async (t) => {
133
124
t . deepEqual ( srIssues , [ ] ) ;
134
125
t . true ( fetch . done ( ) ) ;
135
126
} ) ;
136
-
137
- test ( "Handle error in searchAPI fallback" , async ( t ) => {
138
- const owner = "test_user" ;
139
- const repo = "test_repo" ;
140
- const title = "The automated release is failing 🚨" ;
141
- const labels = [ ] ;
142
- const issues = [ ] ;
143
-
144
- const response = new Response ( "Not Found" , {
145
- url : "https://api.github.com/search/issues?q=in%3Atitle+repo%3Aourorg%2Frepo+type%3Aissue+state%3Aopen+The%20automated%20release%20is%20failing%20%F0%9F%9A%A8" ,
146
- status : 403 ,
147
- headers : {
148
- "access-control-allow-origin" : "*" ,
149
- "access-control-expose-headers" :
150
- "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset" ,
151
- "content-encoding" : "gzip" ,
152
- "content-security-policy" : "default-repo 'none'" ,
153
- "content-type" : "application/json; charset=utf-8" ,
154
- date : "Tue, 28 May 2024 19:49:00 GMT" ,
155
- "referrer-policy" :
156
- "origin-when-cross-origin, strict-origin-when-cross-origin" ,
157
- server : "GitHub.com" ,
158
- "strict-transport-security" :
159
- "max-age=31536000; includeSubdomains; preload" ,
160
- "transfer-encoding" : "chunked" ,
161
- vary : "Accept-Encoding, Accept, X-Requested-With" ,
162
- "x-content-type-options" : "nosniff" ,
163
- "x-frame-options" : "deny" ,
164
- "x-github-api-version-selected" : "2022-11-28" ,
165
- "x-github-media-type" : "github.v3; format=json" ,
166
- "x-github-request-id" : "2**0:29*****4:3868737:6*****3:6****52C" ,
167
- "x-ratelimit-limit" : "30" ,
168
- "x-ratelimit-remaining" : "30" ,
169
- "x-ratelimit-reset" : "1716925800" ,
170
- "x-ratelimit-resource" : "search" ,
171
- "x-ratelimit-used" : "1" ,
172
- "x-xss-protection" : "0" ,
173
- } ,
174
- data : {
175
- documentation_url :
176
- "https://docs.github.com/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits" ,
177
- message :
178
- "You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID 2840:295B44:3868737:64A2183:6232352C." ,
179
- } ,
180
- } ) ;
181
-
182
- const fetch = fetchMock
183
- . sandbox ( )
184
- . postOnce ( "https://api.github.local/graphql" , {
185
- data : {
186
- repository : {
187
- issues : { nodes : issues } ,
188
- } ,
189
- } ,
190
- } )
191
- . getOnce (
192
- `https://api.github.local/search/issues?q=${ encodeURIComponent (
193
- "in:title" ,
194
- ) } +${ encodeURIComponent ( `repo:${ owner } /${ repo } ` ) } +${ encodeURIComponent (
195
- "type:issue" ,
196
- ) } +${ encodeURIComponent ( "state:open" ) } +${ encodeURIComponent ( title ) } `,
197
- response ,
198
- ) ;
199
-
200
- const srIssues = await findSRIssues (
201
- new TestOctokit ( { request : { fetch } } ) ,
202
- t . context . logger ,
203
- title ,
204
- labels ,
205
- owner ,
206
- repo ,
207
- ) ;
208
-
209
- t . true (
210
- t . context . log . calledWith (
211
- "An error occured fetching issue via fallback (with GH SearchAPI)" ,
212
- ) ,
213
- ) ;
214
- t . log ( t . context . log ) ;
215
- t . true ( fetch . done ( ) ) ;
216
- } ) ;
0 commit comments