Skip to content

Commit

Permalink
Update tests to support empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBurunkov committed Jul 16, 2020
1 parent d8c00c5 commit a53b93f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions test/fileFactory.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ describe('Test of the fileFactory factory', function() {
beforeEach(() => server.clearUploadsDir());

it('return a file object', () => assert.ok(fileFactory(mockFileOpts)));
it('return void if buffer is empty and useTempFiles is false.', () => {
assert.equal(fileFactory({
name: mockFileName,
buffer: Buffer.concat([])
}, {
useTempFiles: false
}), null);
});

describe('Properties', function() {
it('contains the name property', () => {
Expand Down
Empty file added test/files/emptyfile.txt
Empty file.
2 changes: 1 addition & 1 deletion test/multipartUploads.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const uploadDir = server.uploadDir;
const clearTempDir = server.clearTempDir;
const clearUploadsDir = server.clearUploadsDir;

const mockFiles = ['car.png', 'tree.png', 'basketball.png'];
const mockFiles = ['car.png', 'tree.png', 'basketball.png', 'emptyfile.txt'];

const mockUser = {
firstName: 'Joe',
Expand Down
2 changes: 1 addition & 1 deletion test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const setup = (fileUploadOptions) => {
const testFile = req.files.testFile;
const fileData = getUploadedFileData(testFile);

testFile.mv(fileData.uploadPath, function(err) {
testFile.mv(fileData.uploadPath, (err) => {
if (err) {
console.log('ERR', err); // eslint-disable-line
return res.status(500).send(err);
Expand Down

0 comments on commit a53b93f

Please sign in to comment.