File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ const init = (config) => {
2929 function destroy ( ) {
3030 destroyed = true ;
3131 return new Promise ( resolve => {
32+ if ( ! inflight . size ) return resolve ( ) ; // eslint-disable-line no-promise-executor-return
33+
3234 let remaining = 0 ;
3335 for ( const req of inflight ) {
3436 ++ remaining ; // eslint-disable-line no-plusplus
Original file line number Diff line number Diff line change @@ -59,6 +59,16 @@ describe('external/s3', () => {
5959 }
6060 } ) ;
6161
62+ describe ( 'destroy()' , ( ) => {
63+ it ( 'should resolve when no requests were made' , async ( ) => {
64+ // given
65+ const singleUseS3 = init ( s3Config ) ;
66+
67+ // expect
68+ should ( await singleUseS3 . destroy ( ) ) . be . undefined ( ) ;
69+ } ) ;
70+ } ) ;
71+
6272 describe ( 'deleteObjsFor()' , ( ) => {
6373 it ( 'should return details for upstream permission error' , async ( ) => {
6474 // given
You can’t perform that action at this time.
0 commit comments