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,39 @@
'use strict';
var expect = require('expect.js');
var sinon = require('sinon');
var cron = require('../src/node-cron');
describe('validate cron on task schaduling', () => {
beforeEach(() => {
this.clock = sinon.useFakeTimers();
});
afterEach(() => {
this.clock.restore();
});
it('should fail with a invalid cron expression', () => {
expect(() => {
cron.schedule('65 * * * *', () => {});
}).to.throwException(function(e){
expect(e).to.equal('65 is a invalid expression for minute');
});
});
it('validate some spaces in task string', () => {
var result = cron.validate('5 * * * *');
expect(result).to.equal(true);
});
it('multiple spaces in task string', () => {
var result = cron.validate('5 * * * *');
expect(result).to.equal(true);
});
it('spaces in begin and end of string', () => {
var result = cron.validate(' 5 * * * * ');
expect(result).to.equal(true);
});
});