From ac309eeff3aeb79d13f12380604b817e5ded42fb Mon Sep 17 00:00:00 2001 From: Richard Girges Date: Sun, 19 Feb 2017 16:43:00 -0800 Subject: [PATCH] just one more test --- test/multipartUploads.spec.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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); + }); + }); } });