@@ -875,34 +875,35 @@ describe('S3Adapter tests', () => {
875
875
} ;
876
876
const s3 = new S3Adapter ( options ) ;
877
877
s3 . _s3Client = s3ClientMock ;
878
-
879
878
// Mock getFileLocation to return a presigned URL
880
879
spyOn ( s3 , 'getFileLocation' ) . and . returnValue ( Promise . resolve ( 'https://presigned-url.com/file.txt' ) ) ;
881
-
880
+
882
881
const result = await s3 . createFile (
883
- 'file.txt' ,
884
- 'hello world' ,
885
- 'text/utf8' ,
882
+ 'file.txt' ,
883
+ 'hello world' ,
884
+ 'text/utf8' ,
886
885
{ } ,
887
886
{ mount : 'http://example.com' , applicationId : 'test123' }
888
887
) ;
889
-
890
- expect ( result . url ) . toBe ( 'https://presigned-url.com/file.txt' ) ;
891
- expect ( result . location ) . toBeDefined ( ) ;
892
- expect ( result . name ) . toBe ( 'file.txt' ) ;
893
- expect ( result . s3_response ) . toBeDefined ( ) ;
888
+
889
+ expect ( result ) . toEqual ( {
890
+ location : jasmine . any ( String ) ,
891
+ name : 'file.txt' ,
892
+ s3_response : jasmine . any ( Object ) ,
893
+ url : 'https://presigned-url.com/file.txt'
894
+ } ) ;
894
895
} ) ;
895
896
896
897
it ( 'should handle generateKey function errors' , async ( ) => {
897
898
const options = {
898
899
bucket : 'bucket-1' ,
899
900
generateKey : ( ) => {
900
- throw new Error ( 'Generate key failed' ) ;
901
+ throw 'Generate key failed' ;
901
902
}
902
903
} ;
903
904
const s3 = new S3Adapter ( options ) ;
904
905
s3 . _s3Client = s3ClientMock ;
905
-
906
+
906
907
await expectAsync (
907
908
s3 . createFile ( 'file.txt' , 'hello world' , 'text/utf8' , { } )
908
909
) . toBeRejectedWithError ( 'Generate key failed' ) ;
0 commit comments