Skip to content

Commit

Permalink
test(rest): improve the file upload test with more than one files
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Feb 10, 2020
1 parent a67d3e4 commit 2e66aab
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,25 @@ describe('multipart/form-data', () => {
.post('/show-body')
.field('user', 'john')
.field('email', '[email protected]')
.attach('testFile', path.resolve(FIXTURES, 'file-upload-test.txt'), {
.attach('testFile1', path.resolve(FIXTURES, 'file-upload-test.txt'), {
filename: 'file-upload-test.txt',
contentType: 'multipart/form-data',
})
.attach('testFile2', path.resolve(FIXTURES, 'assets/index.html'), {
filename: 'index.html',
contentType: 'multipart/form-data',
})
.expect(200);
expect(res.body.files[0]).containEql({
fieldname: 'testFile',
fieldname: 'testFile1',
originalname: 'file-upload-test.txt',
mimetype: 'multipart/form-data',
});
expect(res.body.files[1]).containEql({
fieldname: 'testFile2',
originalname: 'index.html',
mimetype: 'multipart/form-data',
});
});

class FileUploadController {
Expand Down

0 comments on commit 2e66aab

Please sign in to comment.