@@ -162,7 +162,7 @@ describe('Test Upload With Fields', function() {
162162 for ( let i = 0 ; i < mockFiles . length ; i ++ ) {
163163 let fileName = mockFiles [ i ] ;
164164
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 ) {
166166 let filePath = path . join ( fileDir , fileName ) ;
167167 let uploadedFilePath = path . join ( uploadDir , fileName ) ;
168168
@@ -186,5 +186,30 @@ describe('Test Upload With Fields', function() {
186186 fs . stat ( uploadedFilePath , done ) ;
187187 } ) ;
188188 } ) ;
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+ } ) ;
189214 }
190215} ) ;
0 commit comments