@@ -4767,9 +4767,18 @@ describe('beforePasswordResetRequest hook', () => {
47674767 publicServerURL : 'http://localhost:8378/1' ,
47684768 } ) ;
47694769
4770+ const base64 = 'V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=' ;
4771+ const file = new Parse . File ( 'myfile.txt' , { base64 } ) ;
4772+ // Test that the hook not throw "Tried to encode an unsaved file."
4773+ await file . save ( ) ;
4774+
47704775 Parse . Cloud . beforePasswordResetRequest ( req => {
47714776 expect ( req . object ) . toBeDefined ( ) ;
47724777 expect ( req . object . get ( 'email' ) ) . toBeDefined ( ) ;
4778+ expect ( req . object . get ( 'email' ) ) . toBe ( '[email protected] ' ) ; 4779+ expect ( req . object . get ( 'file' ) ) . toBeDefined ( ) ;
4780+ expect ( req . object . get ( 'file' ) ) . toBeInstanceOf ( Parse . File ) ;
4781+ expect ( req . object . get ( 'file' ) . name ( ) ) . toContain ( 'myfile.txt' ) ;
47734782 expect ( req . headers ) . toBeDefined ( ) ;
47744783 expect ( req . ip ) . toBeDefined ( ) ;
47754784 expect ( req . installationId ) . toBeDefined ( ) ;
@@ -4782,10 +4791,6 @@ describe('beforePasswordResetRequest hook', () => {
47824791 user . setPassword ( 'password' ) ;
47834792 user . set ( 'email' , '[email protected] ' ) ; 47844793 await user . signUp ( ) ;
4785- const base64 = 'V29ya2luZyBhdCBQYXJzZSBpcyBncmVhdCE=' ;
4786- const file = new Parse . File ( 'myfile.txt' , { base64 } ) ;
4787- // Test that the hook not throw "Tried to encode an unsaved file."
4788- await file . save ( ) ;
47894794 await user . save ( { file } ) ;
47904795
47914796 await Parse . User . requestPasswordReset ( '[email protected] ' ) ;
0 commit comments