Skip to content

Commit

Permalink
test: fix schedule task test case (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyscript authored and whxaxes committed Mar 22, 2019
1 parent f266d34 commit 6be344f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/file-mode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,17 @@ describe('test/file-mode.test.js', () => {
];
const shouldKeepDirs = [
path.join(app.config.multipart.tmpdir, moment().subtract(2, 'years').format('YYYY/MM/DD/HH')),
path.join(app.config.multipart.tmpdir, moment().subtract(4, 'months').format('YYYY/MM/DD/HH')),
path.join(app.config.multipart.tmpdir, moment().subtract(8, 'days').format('YYYY/MM/DD/HH')),
path.join(app.config.multipart.tmpdir, moment().format('YYYY/MM/DD/HH')),
];
const currentMonth = new Date().getMonth();
const fourMonthBefore = path.join(app.config.multipart.tmpdir, moment().subtract(4, 'months').format('YYYY/MM/DD/HH'));
if (currentMonth < 4) {
// if current month is less than April, four months before shoule be last year.
oldDirs.push(fourMonthBefore);
} else {
shouldKeepDirs.push(fourMonthBefore);
}
await Promise.all(oldDirs.map(dir => mkdirp(dir)));
await Promise.all(shouldKeepDirs.map(dir => mkdirp(dir)));

Expand Down

0 comments on commit 6be344f

Please sign in to comment.