@@ -506,76 +506,6 @@ describe('Concurrency queue test', () => {
506506 } )
507507 . catch ( done )
508508 } )
509-
510- it ( 'should not retry when rate limit remaining is 0' , done => {
511- const mock = new MockAdapter ( api )
512- mock . onGet ( '/ratelimit' ) . reply ( 429 , { errorCode : 429 } , {
513- 'x-ratelimit-remaining' : '0'
514- } )
515-
516- reconfigureQueue ( {
517- retryOnError : true ,
518- retryLimit : 3 ,
519- retryDelay : 300
520- } )
521-
522- api . get ( '/ratelimit' )
523- . catch ( error => {
524- expect ( error . response . status ) . to . equal ( 429 )
525- expect ( error . config . retryCount ) . to . equal ( 0 ) // Should not have retried
526- expect ( logHandlerStub . callCount ) . to . equal ( 0 ) // No retry logs
527- mock . restore ( )
528- done ( )
529- } )
530- } )
531-
532- it ( 'should retry when rate limit remaining is greater than 0' , done => {
533- const mock = new MockAdapter ( api )
534- mock . onGet ( '/ratelimit' ) . reply ( 429 , { errorCode : 429 } , {
535- 'x-ratelimit-remaining' : '5'
536- } )
537- mock . onGet ( '/ratelimit' ) . reply ( 200 , { success : true } )
538-
539- reconfigureQueue ( {
540- retryOnError : true ,
541- retryLimit : 3 ,
542- retryDelay : 300
543- } )
544-
545- api . get ( '/ratelimit' )
546- . then ( response => {
547- /* eslint-disable no-unused-expressions */
548- expect ( response . status ) . to . equal ( 200 )
549- expect ( response . data . success ) . to . be . true
550- /* eslint-enable no-unused-expressions */
551- mock . restore ( )
552- done ( )
553- } )
554- . catch ( done )
555- } )
556-
557- it ( 'should retry when rate limit remaining header is not present' , done => {
558- const mock = new MockAdapter ( api )
559- mock . onGet ( '/ratelimit' ) . reply ( 429 , { errorCode : 429 } )
560- mock . onGet ( '/ratelimit' ) . reply ( 200 , { success : true } )
561-
562- reconfigureQueue ( {
563- retryOnError : true ,
564- retryLimit : 3 ,
565- retryDelay : 300
566- } )
567-
568- api . get ( '/ratelimit' )
569- . then ( response => {
570- /* eslint-disable no-unused-expressions */
571- expect ( response . status ) . to . equal ( 200 )
572- expect ( response . data . success ) . to . be . true
573- /* eslint-enable no-unused-expressions */
574- mock . restore ( )
575- done ( )
576- } )
577- . catch ( done )
578- } )
579509} )
580510
581511function makeConcurrencyQueue ( config ) {
0 commit comments