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

This commit is contained in:
jeonghwa
2026-07-03 05:27:29 +09:00
commit d918e2eddc
2971 changed files with 264195 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);
});
});
});

25
node_modules/node-cron/test/task/task-fail-test.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
'use strict';
var expect = require('expect.js');
var sinon = require('sinon');
var cron = require('../../src/node-cron');
describe('scheduling a task with exception', () =>{
beforeEach(() =>{
this.clock = sinon.useFakeTimers();
});
afterEach(() =>{
this.clock.restore();
});
it('should not stop on task exception', () => {
var executed = 0;
cron.schedule('* * * * *', () =>{
executed += 1;
throw 'exception!';
});
this.clock.tick(3000 * 60 + 1);
expect(executed).to.equal(3);
});
});

90
node_modules/node-cron/test/task/task-hour-test.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('hour', () => {
it('should run a task on hour', () => {
let executed = 0;
var task = new Task('* * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setHours(0);
task.update(date);
date.setHours(15);
task.update(date);
date.setHours(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on hour 12', () => {
let executed = 0;
var task = new Task('0 12 * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setHours(3);
task.update(date);
date.setHours(12);
task.update(date);
date.setHours(15);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on hours 20, 30 and 40 ', () => {
let executed = 0;
var task = new Task('0 5,10,20 * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setHours(5);
task.update(date);
date.setHours(10);
task.update(date);
date.setHours(13);
task.update(date);
date.setHours(20);
task.update(date);
date.setHours(22);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even hours', () => {
let executed = 0;
var task = new Task('* */2 * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setHours(0);
task.update(date);
date.setHours(15);
task.update(date);
date.setHours(50);
task.update(date);
expect(2).to.equal(executed);
});
it('should run every hour on range', () => {
let executed = 0;
var task = new Task('* 8-20 * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setHours(0);
task.update(date);
date.setHours(8);
task.update(date);
date.setHours(19);
task.update(date);
date.setHours(21);
task.update(date);
expect(2).to.equal(executed);
});
});
});

73
node_modules/node-cron/test/task/task-minute-test.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('minute', () => {
it('should run a task on minute', () => {
let executed = 0;
var task = new Task('* * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMinutes(0);
task.update(date);
date.setMinutes(15);
task.update(date);
date.setMinutes(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on minute 33', () => {
let executed = 0;
var task = new Task('33 * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMinutes(3);
task.update(date);
date.setMinutes(33);
task.update(date);
date.setMinutes(32);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on minutes 20, 30 and 40 ', () => {
let executed = 0;
var task = new Task('20,30,40 * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMinutes(20);
task.update(date);
date.setMinutes(30);
task.update(date);
date.setMinutes(33);
task.update(date);
date.setMinutes(40);
task.update(date);
date.setMinutes(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even minutes', () => {
let executed = 0;
var task = new Task('*/2 * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMinutes(0);
task.update(date);
date.setMinutes(15);
task.update(date);
date.setMinutes(50);
task.update(date);
expect(2).to.equal(executed);
});
});
});

82
node_modules/node-cron/test/task/task-month-test.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('month', () => {
it('should run a task on month', () => {
let executed = 0;
var task = new Task('* * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMonth(0);
task.update(date);
date.setMonth(10);
task.update(date);
date.setMonth(12);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on month 9', () => {
let executed = 0;
var task = new Task('* * * 9 *', () => {
executed += 1;
});
var date = new Date(2016, 3, 1);
date.setMonth(3);
task.update(date);
date.setMonth(8);
task.update(date);
date.setMonth(10);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on months 2, 4 and 6 ', () => {
let executed = 0;
var task = new Task('* * * 2,4,6 *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMonth(0);
task.update(date);
date.setMonth(1);
task.update(date);
date.setMonth(3);
task.update(date);
date.setMonth(5);
task.update(date);
date.setMonth(7);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even months', () => {
let executed = 0;
var task = new Task('* * * */2 *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setMonth(1);
task.update(date);
date.setMonth(9);
task.update(date);
date.setMonth(8);
task.update(date);
expect(2).to.equal(executed);
});
it('should run on September', () => {
let executed = 0;
var task = new Task('* * * Sep *', () => {
executed += 1;
});
task.update(new Date(2016, 8, 1));
expect(1).to.equal(executed);
});
});
});

73
node_modules/node-cron/test/task/task-second-test.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('second', () => {
it('should run a task on second', () => {
let executed = 0;
var task = new Task('* * * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setSeconds(0);
task.update(date);
date.setSeconds(15);
task.update(date);
date.setSeconds(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on second 33', () => {
let executed = 0;
var task = new Task('33 * * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setSeconds(3);
task.update(date);
date.setSeconds(33);
task.update(date);
date.setSeconds(32);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on seconds 20, 30 and 40 ', () => {
let executed = 0;
var task = new Task('20,30,40 * * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setSeconds(20);
task.update(date);
date.setSeconds(30);
task.update(date);
date.setSeconds(33);
task.update(date);
date.setSeconds(40);
task.update(date);
date.setSeconds(50);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even seconds', () => {
let executed = 0;
var task = new Task('*/2 * * * * *', () => {
executed += 1;
});
var date = new Date(2016, 1, 1);
date.setSeconds(0);
task.update(date);
date.setSeconds(15);
task.update(date);
date.setSeconds(50);
task.update(date);
expect(2).to.equal(executed);
});
});
});

View File

@@ -0,0 +1,89 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('week day & day of month', () => {
it('should run on week day', () => {
let executed = 0;
var task = new Task('* * * * 1', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(1).to.equal(executed);
});
it('should run on day of month', () => {
let executed = 0;
var task = new Task('* * 1 * *', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(1).to.equal(executed);
});
it('should run on week day & day of month', () => {
let executed = 0;
var task = new Task('* * 1 * 1', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(2).to.equal(executed);
});
it('should run on week day with seconds', () => {
let executed = 0;
var task = new Task('0 * * * * 1', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(1).to.equal(executed);
});
it('should run on day of month with seconds', () => {
let executed = 0;
var task = new Task('0 * * 1 * *', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(1).to.equal(executed);
});
it('should run on week day & day of month with seconds', () => {
let executed = 0;
var task = new Task('0 * * 1 * 1', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
for (var day = 1; day <= 7; day++) {
date.setDate(day);
task.update(date);
}
expect(2).to.equal(executed);
});
});
});

82
node_modules/node-cron/test/task/task-week-day-test.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
var expect = require('expect.js');
var Task = require('../../src/task');
describe('Task', () => {
describe('week day', () => {
it('should run on week day', () => {
let executed = 0;
var task = new Task('* * * * *', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
date.setDate(4);
task.update(date);
date.setDate(5);
task.update(date);
date.setDate(6);
task.update(date);
expect(3).to.equal(executed);
});
it('should run only on week day 3', () => {
let executed = 0;
var task = new Task('* * * * 3', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
date.setDate(5);
task.update(date);
date.setDate(6);
task.update(date);
date.setDate(9);
task.update(date);
expect(1).to.equal(executed);
});
it('should run only on week days 2, 3 and 5 ', () => {
let executed = 0;
var task = new Task('* * * * 2,3,5', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
date.setDate(4);
task.update(date);
date.setDate(5);
task.update(date);
date.setDate(6);
task.update(date);
date.setDate(7);
task.update(date);
date.setDate(8);
task.update(date);
expect(3).to.equal(executed);
});
it('should run in even week days', () => {
let executed = 0;
var task = new Task('* * * * */2', () => {
executed += 1;
});
var date = new Date(2016, 0, 1);
date.setDate(4);
task.update(date);
date.setDate(5);
task.update(date);
date.setDate(7);
task.update(date);
expect(2).to.equal(executed);
});
it('should run on monday', () => {
let executed = 0;
var task = new Task('* * * * Monday', () => {
executed += 1;
});
task.update(new Date(2016, 0, 4));
expect(1).to.equal(executed);
});
});
});