Initial import from local backup (Documents-Playground/pakerpale)

This commit is contained in:
jeonghwa
2026-07-03 05:27:12 +09:00
commit 3e8d82ea89
4047 changed files with 557006 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('day of day', () => {
it('should run on day', () => {
let executed = 0;
var task = new Task('* * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setDate(0);
task.update(date);
date.setDate(15);
task.update(date);
date.setDate(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on day 9', () => {
let executed = 0;
var task = new Task('* * 9 * *', () => {
executed += 1;
});
executed = 0;
var date = new Date(2016, 1, 1);
date.setDate(3);
task.update(date);
date.setDate(9);
task.update(date);
date.setDate(11);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on day 4, 6 and 12 ', () => {
let executed = 0;
var task = new Task('* * 4,6,12 * *', () => {
executed += 1;
});
executed = 0;
var date = new Date(2016, 1, 1);
date.setDate(1);
task.update(date);
date.setDate(4);
task.update(date);
date.setDate(6);
task.update(date);
date.setDate(8);
task.update(date);
date.setDate(12);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even day', () => {
let executed = 0;
var task = new Task('* * */2 * *', () => {
executed += 1;
});
executed = 0;
var date = new Date(2016, 1, 1);
date.setDate(2);
task.update(date);
date.setDate(15);
task.update(date);
date.setDate(20);
task.update(date);
expect(2).to.equal(executed);
});
});
});