qinglong/test-cron2.mjs
copilot-swe-agent[bot] 8de5bff700 Update plan - Fix frontend imports for cron-parser
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2026-01-29 11:31:50 +00:00

23 lines
675 B
JavaScript

import CronExpressionParser from 'cron-parser';
// Test cases - same as the image shows
const testExpressions = [
'*/8 * * * *', // 5 fields (every 8 minutes)
'*/8 * * * * ?', // 6 fields with seconds (every 8 seconds) - FROM THE IMAGE
];
console.log('Testing with default import (like the validation code):\n');
testExpressions.forEach(expr => {
try {
const parsed = CronExpressionParser.parse(expr);
if (parsed.hasNext()) {
console.log(`✓ "${expr}" - VALID, hasNext: true`);
} else {
console.log(`? "${expr}" - parsed but hasNext is false`);
}
} catch (e) {
console.log(`✗ "${expr}" - INVALID: ${e.message}`);
}
});