@@ -162,7 +162,7 @@ describe('Test Upload With Fields', function() {
162
162
for ( let i = 0 ; i < mockFiles . length ; i ++ ) {
163
163
let fileName = mockFiles [ i ] ;
164
164
165
- it ( `upload ${ fileName } and submit fields at the same time` , function ( done ) {
165
+ it ( `upload ${ fileName } and submit fields at the same time with POST ` , function ( done ) {
166
166
let filePath = path . join ( fileDir , fileName ) ;
167
167
let uploadedFilePath = path . join ( uploadDir , fileName ) ;
168
168
@@ -186,5 +186,30 @@ describe('Test Upload With Fields', function() {
186
186
fs . stat ( uploadedFilePath , done ) ;
187
187
} ) ;
188
188
} ) ;
189
+
190
+ it ( `upload ${ fileName } and submit fields at the same time with PUT` , function ( done ) {
191
+ let filePath = path . join ( fileDir , fileName ) ;
192
+ let uploadedFilePath = path . join ( uploadDir , fileName ) ;
193
+
194
+ clearUploadsDir ( ) ;
195
+
196
+ request ( app )
197
+ . put ( '/upload/single/withfields' )
198
+ . attach ( 'testFile' , filePath )
199
+ . field ( 'firstName' , mockUser . firstName )
200
+ . field ( 'lastName' , mockUser . lastName )
201
+ . field ( 'email' , mockUser . email )
202
+ . expect ( 200 , {
203
+ firstName : mockUser . firstName ,
204
+ lastName : mockUser . lastName ,
205
+ email : mockUser . email
206
+ } ,
207
+ function ( err , res ) {
208
+ if ( err )
209
+ return done ( err ) ;
210
+
211
+ fs . stat ( uploadedFilePath , done ) ;
212
+ } ) ;
213
+ } ) ;
189
214
}
190
215
} ) ;
0 commit comments