@@ -107,11 +107,20 @@ describe("File upload", function () {
107107 maxTags : 10
108108 }
109109 ] ,
110- webhookUrl : "https://your-domain/?appId=some-id"
110+ webhookUrl : "https://your-domain/?appId=some-id" ,
111+ overwriteFile : true ,
112+ overwriteAITags : false ,
113+ overwriteTags : true ,
114+ overwriteCustomMetadata : false ,
115+ customMetadata : {
116+ brand : "Nike" ,
117+ color : "red"
118+ } ,
111119 } ;
112120
113121 var callback = sinon . spy ( ) ;
114122 var jsonStringifiedExtensions = JSON . stringify ( fileOptions . extensions ) ;
123+ const customMetadata = JSON . stringify ( fileOptions . customMetadata ) ;
115124
116125 const scope = nock ( 'https://upload.imagekit.io/api' )
117126 . post ( '/v1/files/upload' )
@@ -127,6 +136,11 @@ describe("File upload", function () {
127136 checkFormData ( { requestBody, boundary, fieldName :"responseFields" , fieldValue :"tags,metadata" } ) ;
128137 checkFormData ( { requestBody, boundary, fieldName :"extensions" , fieldValue :jsonStringifiedExtensions } ) ;
129138 checkFormData ( { requestBody, boundary, fieldName :"webhookUrl" , fieldValue :"https://your-domain/?appId=some-id" } ) ;
139+ checkFormData ( { requestBody, boundary, fieldName :"overwriteFile" , fieldValue :"true" } ) ;
140+ checkFormData ( { requestBody, boundary, fieldName :"overwriteAITags" , fieldValue :"false" } ) ;
141+ checkFormData ( { requestBody, boundary, fieldName :"overwriteTags" , fieldValue :"true" } ) ;
142+ checkFormData ( { requestBody, boundary, fieldName :"overwriteCustomMetadata" , fieldValue :"false" } ) ;
143+ checkFormData ( { requestBody, boundary, fieldName :"customMetadata" , fieldValue :customMetadata } ) ;
130144 done ( )
131145 } )
132146
0 commit comments