@@ -340,8 +340,17 @@ describe('S3Adapter tests', () => {
340
340
it ( 'should get using the baseUrl and amazon using presigned URL' , ( ) => {
341
341
options . presignedUrl = true ;
342
342
const s3 = new S3Adapter ( 'accessKey' , 'secretKey' , 'my-bucket' , options ) ;
343
+ const originalS3Client = s3 . _s3Client ;
344
+ let getSignedUrlOperation = '' ;
345
+ s3 . _s3Client = {
346
+ getSignedUrl : ( operation , params , callback ) => {
347
+ getSignedUrlOperation = operation ;
348
+ return originalS3Client . getSignedUrl ( operation , params , callback ) ;
349
+ } ,
350
+ } ;
343
351
344
352
const fileLocation = s3 . getFileLocation ( testConfig , 'test.png' ) ;
353
+ expect ( getSignedUrlOperation ) . toBe ( 'getObject' ) ;
345
354
expect ( fileLocation ) . toMatch ( / ^ h t t p : \/ \/ e x a m p l e .c o m \/ f i l e s \/ f o o \/ b a r \/ t e s t .p n g \? / ) ;
346
355
expect ( fileLocation ) . toMatch ( / X - A m z - C r e d e n t i a l = a c c e s s K e y % 2 F \d { 8 } % 2 F u s - e a s t - 1 % 2 F s 3 % 2 F a w s 4 _ r e q u e s t / ) ;
347
356
expect ( fileLocation ) . toMatch ( / X - A m z - D a t e = \d { 8 } T \d { 6 } Z / ) ;
@@ -373,8 +382,17 @@ describe('S3Adapter tests', () => {
373
382
delete options . baseUrl ;
374
383
options . presignedUrl = true ;
375
384
const s3 = new S3Adapter ( 'accessKey' , 'secretKey' , 'my-bucket' , options ) ;
385
+ const originalS3Client = s3 . _s3Client ;
386
+ let getSignedUrlOperation = '' ;
387
+ s3 . _s3Client = {
388
+ getSignedUrl : ( operation , params , callback ) => {
389
+ getSignedUrlOperation = operation ;
390
+ return originalS3Client . getSignedUrl ( operation , params , callback ) ;
391
+ } ,
392
+ } ;
376
393
377
394
const fileLocation = s3 . getFileLocation ( testConfig , 'test.png' ) ;
395
+ expect ( getSignedUrlOperation ) . toBe ( 'getObject' ) ;
378
396
expect ( fileLocation ) . toMatch ( / ^ h t t p s : \/ \/ m y - b u c k e t .s 3 .a m a z o n a w s .c o m \/ f o o \/ b a r \/ t e s t .p n g \? / ) ;
379
397
expect ( fileLocation ) . toMatch ( / X - A m z - C r e d e n t i a l = a c c e s s K e y % 2 F \d { 8 } % 2 F u s - e a s t - 1 % 2 F s 3 % 2 F a w s 4 _ r e q u e s t / ) ;
380
398
expect ( fileLocation ) . toMatch ( / X - A m z - D a t e = \d { 8 } T \d { 6 } Z / ) ;
0 commit comments