File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,62 @@ describe("Automatic Retries", function () {
265
265
266
266
expect ( caught ) . toEqual ( testStatuses . length ) ;
267
267
} ) ;
268
+
269
+ it . only ( 'Should retry "Something went wrong" GraphQL error' , async function ( ) {
270
+ const octokit = new TestOctokit ( ) ;
271
+
272
+ const result = await octokit . graphql ( {
273
+ query : `query {
274
+ viewer {
275
+ login
276
+ }
277
+ }` ,
278
+ request : {
279
+ responses : [
280
+ {
281
+ status : 200 ,
282
+ headers : { } ,
283
+ data : {
284
+ errors : [
285
+ {
286
+ message :
287
+ // the `0000:0000:0000000:0000000:00000000` part is variable, it's the request ID provided by GitHub
288
+ "Something went wrong while executing your query. Please include `0000:0000:0000000:0000000:00000000` when reporting this issue." ,
289
+ } ,
290
+ ] ,
291
+ } ,
292
+ } ,
293
+ {
294
+ status : 200 ,
295
+ headers : { } ,
296
+ data : {
297
+ data : {
298
+ viewer : {
299
+ login : "gr2m" ,
300
+ } ,
301
+ } ,
302
+ } ,
303
+ } ,
304
+ ] ,
305
+ retries : 1 ,
306
+ } ,
307
+ } ) ;
308
+
309
+ expect ( result ) . toStrictEqual ( {
310
+ viewer : {
311
+ login : "gr2m" ,
312
+ } ,
313
+ } ) ;
314
+ expect ( octokit . __requestLog ) . toStrictEqual ( [
315
+ "START POST /graphql" ,
316
+ "START POST /graphql" ,
317
+ "END POST /graphql" ,
318
+ ] ) ;
319
+
320
+ expect (
321
+ octokit . __requestTimings [ 1 ] - octokit . __requestTimings [ 0 ]
322
+ ) . toBeLessThan ( 20 ) ;
323
+ } ) ;
268
324
} ) ;
269
325
270
326
describe ( "errorRequest" , function ( ) {
You can’t perform that action at this time.
0 commit comments