File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,19 @@ jest.mock('formdata-node', () => {
1010 return {
1111 FormData : jest . fn ( ) . mockImplementation ( function ( this : MockedFormData ) {
1212 const appendedData : Record < string , any > = { } ;
13- this . append = ( key : string , value : any , _filename ?: string ) => {
14- if ( value && typeof value === 'object' && 'content' in value ) {
15- // Handle File objects
16- appendedData [ key ] = value . content ;
17- } else {
18- appendedData [ key ] = value ;
19- }
20- } ;
21- this . _getAppendedData = ( ) => appendedData ;
22- // Ensure the form property also has access to _getAppendedData
23- ( this as any ) . form = {
13+ const form = {
14+ append : ( key : string , value : any , _filename ?: string ) => {
15+ if ( value && typeof value === 'object' && 'content' in value ) {
16+ // Handle File objects
17+ appendedData [ key ] = value . content ;
18+ } else {
19+ appendedData [ key ] = value ;
20+ }
21+ } ,
2422 _getAppendedData : ( ) => appendedData ,
2523 } ;
24+ Object . assign ( this , form ) ;
25+ ( this as any ) . form = this ;
2626 return this ;
2727 } ) ,
2828 File : jest . fn ( ) . mockImplementation ( ( content : any [ ] , name : string ) => ( {
You can’t perform that action at this time.
0 commit comments