Skip to content

Commit

Permalink
Add clearUploadsDir
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Mrowiec committed Dec 6, 2017
1 parent 91d944f commit 1c52f44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/fileLimitUploads.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ const server = require('./server');
const app = server.setup({
limits: {fileSize: 200 * 1024} // set 200kb upload limit
});
const clearUploadsDir = server.clearUploadsDir;
const fileDir = server.fileDir;

describe('Test Single File Upload With File Size Limit', function() {
it(`upload 'basketball.png' (~154kb) with 200kb size limit`, function(done) {
let filePath = path.join(fileDir, 'basketball.png');

clearUploadsDir();

request(app)
.post('/upload/single')
.attach('testFile', filePath)
Expand All @@ -22,6 +25,8 @@ describe('Test Single File Upload With File Size Limit', function() {
it(`fail when uploading 'car.png' (~269kb) with 200kb size limit`, function(done) {
let filePath = path.join(fileDir, 'car.png');

clearUploadsDir();

request(app)
.post('/upload/single')
.attach('testFile', filePath)
Expand Down

0 comments on commit 1c52f44

Please sign in to comment.