File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -715,4 +715,51 @@ describe('list', () => {
715715 expect ( mockStore . fulfilled ) . toBeTruthy ( )
716716 } )
717717 } )
718+
719+ test ( 'Uses the uncached edge URL if `consistency: "strong"`' , async ( ) => {
720+ const uncachedEdgeURL = 'https://uncached-edge.netlify'
721+ const mockStore = new MockFetch ( ) . get ( {
722+ headers : { authorization : `Bearer ${ edgeToken } ` } ,
723+ response : new Response (
724+ JSON . stringify ( {
725+ blobs : [
726+ {
727+ etag : 'etag1' ,
728+ key : 'key1' ,
729+ size : 1 ,
730+ last_modified : '2023-07-18T12:59:06Z' ,
731+ } ,
732+ {
733+ etag : 'etag2' ,
734+ key : 'key2' ,
735+ size : 2 ,
736+ last_modified : '2023-07-18T12:59:06Z' ,
737+ } ,
738+ ] ,
739+ directories : [ ] ,
740+ } ) ,
741+ ) ,
742+ url : `${ uncachedEdgeURL } /${ siteID } /site:${ storeName } ` ,
743+ } )
744+
745+ globalThis . fetch = mockStore . fetch
746+
747+ const store = getStore ( {
748+ consistency : 'strong' ,
749+ edgeURL,
750+ name : storeName ,
751+ token : edgeToken ,
752+ siteID,
753+ uncachedEdgeURL,
754+ } )
755+
756+ const { blobs, directories } = await store . list ( )
757+
758+ expect ( blobs ) . toEqual ( [
759+ { etag : 'etag1' , key : 'key1' } ,
760+ { etag : 'etag2' , key : 'key2' } ,
761+ ] )
762+ expect ( directories ) . toEqual ( [ ] )
763+ expect ( mockStore . fulfilled ) . toBeTruthy ( )
764+ } )
718765} )
You can’t perform that action at this time.
0 commit comments