@@ -1500,7 +1500,7 @@ describe('deleteAll', () => {
15001500 const mockStore = new MockFetch ( )
15011501 . delete ( {
15021502 headers : { authorization : `Bearer ${ apiToken } ` } ,
1503- response : Response . json ( { blobs_deleted : 3 } ) ,
1503+ response : Response . json ( { blobs_deleted : 3 , has_more : false } ) ,
15041504 url : `https://api.netlify.com/api/v1/blobs/${ siteID } /site:production` ,
15051505 } )
15061506 . inject ( )
@@ -1542,7 +1542,7 @@ describe('deleteAll', () => {
15421542 const mockStore = new MockFetch ( )
15431543 . delete ( {
15441544 headers : { authorization : `Bearer ${ apiToken } ` } ,
1545- response : Response . json ( { blobs_deleted : 3 } ) ,
1545+ response : Response . json ( { blobs_deleted : 3 , has_more : false } ) ,
15461546 url : `https://api.netlify.com/api/v1/blobs/${ siteID } /oldie` ,
15471547 } )
15481548 . inject ( )
@@ -1565,7 +1565,7 @@ describe('deleteAll', () => {
15651565 const mockStore = new MockFetch ( )
15661566 . delete ( {
15671567 headers : { authorization : `Bearer ${ edgeToken } ` } ,
1568- response : Response . json ( { blobs_deleted : 3 } ) ,
1568+ response : Response . json ( { blobs_deleted : 3 , has_more : false } ) ,
15691569 url : `${ edgeURL } /${ siteID } /site:production` ,
15701570 } )
15711571 . inject ( )
@@ -1605,6 +1605,33 @@ describe('deleteAll', () => {
16051605
16061606 expect ( mockStore . fulfilled ) . toBeTruthy ( )
16071607 } )
1608+
1609+ test ( 'Handles paginated deletion with multiple batches' , async ( ) => {
1610+ const mockStore = new MockFetch ( )
1611+ . delete ( {
1612+ headers : { authorization : `Bearer ${ edgeToken } ` } ,
1613+ response : Response . json ( { blobs_deleted : 100 , has_more : true } ) ,
1614+ url : `${ edgeURL } /${ siteID } /site:production` ,
1615+ } )
1616+ . delete ( {
1617+ headers : { authorization : `Bearer ${ edgeToken } ` } ,
1618+ response : Response . json ( { blobs_deleted : 50 , has_more : false } ) ,
1619+ url : `${ edgeURL } /${ siteID } /site:production` ,
1620+ } )
1621+ . inject ( )
1622+
1623+ const blobs = getStore ( {
1624+ edgeURL,
1625+ name : 'production' ,
1626+ token : edgeToken ,
1627+ siteID,
1628+ } )
1629+
1630+ const res = await blobs . deleteAll ( )
1631+
1632+ expect ( mockStore . fulfilled ) . toBeTruthy ( )
1633+ expect ( res . deletedBlobs ) . toBe ( 150 )
1634+ } )
16081635 } )
16091636} )
16101637
0 commit comments