@@ -842,34 +842,35 @@ describe('S3Adapter tests', () => {
842
842
} ;
843
843
const s3 = new S3Adapter ( options ) ;
844
844
s3 . _s3Client = s3ClientMock ;
845
-
846
845
// Mock getFileLocation to return a presigned URL
847
846
spyOn ( s3 , 'getFileLocation' ) . and . returnValue ( Promise . resolve ( 'https://presigned-url.com/file.txt' ) ) ;
848
-
847
+
849
848
const result = await s3 . createFile (
850
- 'file.txt' ,
851
- 'hello world' ,
852
- 'text/utf8' ,
849
+ 'file.txt' ,
850
+ 'hello world' ,
851
+ 'text/utf8' ,
853
852
{ } ,
854
853
{ mount : 'http://example.com' , applicationId : 'test123' }
855
854
) ;
856
-
857
- expect ( result . url ) . toBe ( 'https://presigned-url.com/file.txt' ) ;
858
- expect ( result . location ) . toBeDefined ( ) ;
859
- expect ( result . name ) . toBe ( 'file.txt' ) ;
860
- expect ( result . s3_response ) . toBeDefined ( ) ;
855
+
856
+ expect ( result ) . toEqual ( {
857
+ location : jasmine . any ( String ) ,
858
+ name : 'file.txt' ,
859
+ s3_response : jasmine . any ( Object ) ,
860
+ url : 'https://presigned-url.com/file.txt'
861
+ } ) ;
861
862
} ) ;
862
863
863
864
it ( 'should handle generateKey function errors' , async ( ) => {
864
865
const options = {
865
866
bucket : 'bucket-1' ,
866
867
generateKey : ( ) => {
867
- throw new Error ( 'Generate key failed' ) ;
868
+ throw 'Generate key failed' ;
868
869
}
869
870
} ;
870
871
const s3 = new S3Adapter ( options ) ;
871
872
s3 . _s3Client = s3ClientMock ;
872
-
873
+
873
874
await expectAsync (
874
875
s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } )
875
876
) . toBeRejectedWithError ( 'Generate key failed' ) ;
0 commit comments