File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,14 +118,10 @@ describeAcceptance(
118118 message : 'success' ,
119119 } )
120120
121- const missingPurge = await client . request (
122- 'DELETE' ,
123- `/cdn/${ bucketName } /${ encodePathSegments ( missingBucketName ) } ` ,
124- {
125- expectedStatus : [ 400 , 404 ] ,
126- token : requireServiceKey ( ) ,
127- }
128- )
121+ const missingPurge = await client . request ( 'DELETE' , `/cdn/${ missingBucketName } ` , {
122+ expectedStatus : [ 400 , 404 ] ,
123+ token : requireServiceKey ( ) ,
124+ } )
129125 expect ( missingPurge . json ) . toBeTruthy ( )
130126 } finally {
131127 await cleanupRestResources ( bucketName , [ ] , client )
Original file line number Diff line number Diff line change @@ -164,6 +164,29 @@ describe('CDN Cache Manager', () => {
164164 } )
165165 } )
166166
167+ it ( 'will purge entire bucket when using bucket endpoint' , async ( ) => {
168+ const purgeSpy = vi . spyOn ( CdnCacheManager . prototype , 'purge' ) . mockResolvedValue ( undefined )
169+
170+ const response = await appInstance . inject ( {
171+ method : 'DELETE' ,
172+ url : `/cdn/${ bucketName } /` ,
173+ headers : {
174+ authorization : `Bearer ${ await serviceKeyAsync } ` ,
175+ } ,
176+ } )
177+
178+ expect ( response . statusCode ) . toBe ( 200 )
179+
180+ const body = await response . json ( )
181+ expect ( body ) . toEqual ( { message : 'success' } )
182+ expect ( purgeSpy ) . toHaveBeenCalledWith ( {
183+ type : 'object' ,
184+ tenant : tenantId ,
185+ bucket : bucketName ,
186+ objectName : '' ,
187+ } )
188+ } )
189+
167190 it ( 'will purge bucket transformations when transformations query param is true' , async ( ) => {
168191 const purgeSpy = vi . spyOn ( CdnCacheManager . prototype , 'purge' ) . mockResolvedValue ( undefined )
169192
You can’t perform that action at this time.
0 commit comments