@@ -3,7 +3,7 @@ const config = require('config');
33const filesAdapterTests = require ( 'parse-server-conformance-tests' ) . files ;
44const S3Adapter = require ( '../index.js' ) ;
55const optionsFromArguments = require ( '../lib/optionsFromArguments' ) ;
6- const { makeS3Adapter } = require ( "./mocks/s3adapter-v2.js" ) ;
6+ const { getMockS3Adapter } = require ( "./mocks/s3adapter-v2.js" ) ;
77
88describe ( 'S3Adapter tests' , ( ) => {
99 beforeEach ( ( ) => {
@@ -480,7 +480,7 @@ describe('S3Adapter tests', () => {
480480 } ) ;
481481
482482 it ( 'should return a file with a date stamp inserted in the path' , ( ) => {
483- const s3 = makeS3Adapter ( options ) ;
483+ const s3 = getMockS3Adapter ( options ) ;
484484 const fileName = 'randomFileName.txt' ;
485485 const response = s3 . createFile ( fileName , 'hello world' , 'text/utf8' ) . then ( ( value ) => {
486486 const url = new URL ( value . Location ) ;
@@ -491,7 +491,7 @@ describe('S3Adapter tests', () => {
491491
492492 it ( 'should do nothing when null' , ( ) => {
493493 options . generateKey = null ;
494- const s3 = makeS3Adapter ( options ) ;
494+ const s3 = getMockS3Adapter ( options ) ;
495495 const fileName = 'foo/randomFileName.txt' ;
496496 const response = s3 . createFile ( fileName , 'hello world' , 'text/utf8' ) . then ( ( value ) => {
497497 const url = new URL ( value . Location ) ;
@@ -501,7 +501,7 @@ describe('S3Adapter tests', () => {
501501 } ) ;
502502
503503 it ( 'should add unique timestamp to the file name after the last directory when there is a path' , ( ) => {
504- const s3 = makeS3Adapter ( options ) ;
504+ const s3 = getMockS3Adapter ( options ) ;
505505 const fileName = 'foo/randomFileName.txt' ;
506506 const response = s3 . createFile ( fileName , 'hello world' , 'text/utf8' ) . then ( ( value ) => {
507507 const url = new URL ( value . Location ) ;
@@ -523,7 +523,7 @@ describe('S3Adapter tests', () => {
523523 } ) ;
524524
525525 it ( 'should save a file with metadata added' , async ( ) => {
526- const s3 = makeS3Adapter ( options ) ;
526+ const s3 = getMockS3Adapter ( options ) ;
527527 s3 . _s3Client . upload = ( params , callback ) => {
528528 const { Metadata } = params ;
529529 expect ( Metadata ) . toEqual ( { foo : 'bar' } ) ;
@@ -538,7 +538,7 @@ describe('S3Adapter tests', () => {
538538 } ) ;
539539
540540 it ( 'should save a file with tags added' , async ( ) => {
541- const s3 = makeS3Adapter ( options ) ;
541+ const s3 = getMockS3Adapter ( options ) ;
542542 s3 . _s3Client . upload = ( params , callback ) => {
543543 const { Tagging } = params ;
544544 expect ( Tagging ) . toEqual ( 'foo=bar&baz=bin' ) ;
@@ -555,7 +555,7 @@ describe('S3Adapter tests', () => {
555555 it ( 'should save a file with proper ACL with direct access' , async ( ) => {
556556 // Create adapter
557557 options . directAccess = true ;
558- const s3 = makeS3Adapter ( options ) ;
558+ const s3 = getMockS3Adapter ( options ) ;
559559 spyOn ( s3 . _s3Client , 'upload' ) . and . callThrough ( ) ;
560560 // Save file
561561 await s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } ) ;
@@ -569,7 +569,7 @@ describe('S3Adapter tests', () => {
569569
570570 it ( 'should save a file with proper ACL without direct access' , async ( ) => {
571571 // Create adapter
572- const s3 = makeS3Adapter ( options ) ;
572+ const s3 = getMockS3Adapter ( options ) ;
573573 spyOn ( s3 . _s3Client , 'upload' ) . and . callThrough ( ) ;
574574 // Save file
575575 await s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } ) ;
@@ -585,7 +585,7 @@ describe('S3Adapter tests', () => {
585585 // Create adapter
586586 options . directAccess = true ;
587587 options . fileAcl = 'private' ;
588- const s3 = makeS3Adapter ( options ) ;
588+ const s3 = getMockS3Adapter ( options ) ;
589589 spyOn ( s3 . _s3Client , 'upload' ) . and . callThrough ( ) ;
590590 // Save file
591591 await s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } ) ;
@@ -601,7 +601,7 @@ describe('S3Adapter tests', () => {
601601 // Create adapter
602602 options . directAccess = true ;
603603 options . fileAcl = 'none' ;
604- const s3 = makeS3Adapter ( options ) ;
604+ const s3 = getMockS3Adapter ( options ) ;
605605 spyOn ( s3 . _s3Client , 'upload' ) . and . callThrough ( ) ;
606606 // Save file
607607 await s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } ) ;
@@ -614,5 +614,5 @@ describe('S3Adapter tests', () => {
614614 } ) ;
615615 } ) ;
616616
617- filesAdapterTests . testAdapter ( 'S3Adapter' , makeS3Adapter ( { } ) ) ;
617+ filesAdapterTests . testAdapter ( 'S3Adapter' , getMockS3Adapter ( { } ) ) ;
618618} ) ;
0 commit comments