diff --git a/test/multipartUploads.spec.js b/test/multipartUploads.spec.js index d237404..0dc1e1c 100644 --- a/test/multipartUploads.spec.js +++ b/test/multipartUploads.spec.js @@ -162,7 +162,7 @@ describe('Test Upload With Fields', function() { for (let i = 0; i < mockFiles.length; i++) { let fileName = mockFiles[i]; - it(`upload ${fileName} and submit fields at the same time`, function(done) { + it(`upload ${fileName} and submit fields at the same time with POST`, function(done) { let filePath = path.join(fileDir, fileName); let uploadedFilePath = path.join(uploadDir, fileName); @@ -186,5 +186,30 @@ describe('Test Upload With Fields', function() { fs.stat(uploadedFilePath, done); }); }); + + it(`upload ${fileName} and submit fields at the same time with PUT`, function(done) { + let filePath = path.join(fileDir, fileName); + let uploadedFilePath = path.join(uploadDir, fileName); + + clearUploadsDir(); + + request(app) + .put('/upload/single/withfields') + .attach('testFile', filePath) + .field('firstName', mockUser.firstName) + .field('lastName', mockUser.lastName) + .field('email', mockUser.email) + .expect(200, { + firstName: mockUser.firstName, + lastName: mockUser.lastName, + email: mockUser.email + }, + function(err, res) { + if (err) + return done(err); + + fs.stat(uploadedFilePath, done); + }); + }); } });