2020-11-05 07:07:27 +03:00
|
|
|
// Switch these lines once there are useful utils
|
|
|
|
// const testUtils = require('./utils');
|
|
|
|
require('./utils');
|
|
|
|
|
2020-11-10 07:11:31 +03:00
|
|
|
const isCronExpression = require('../lib/is-cron-expression');
|
2020-11-05 07:07:27 +03:00
|
|
|
|
|
|
|
describe('Is cron expression', function () {
|
|
|
|
it('valid cron expressions', function () {
|
2020-11-24 06:44:54 +03:00
|
|
|
should(isCronExpression('* * * * * *')).be.true();
|
|
|
|
should(isCronExpression('1 * * * * *')).be.true();
|
|
|
|
should(isCronExpression('0 0 13-23 * * *'), 'Range should be 0-23').be.true();
|
2020-11-05 07:07:27 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('invalid cron expressions', function () {
|
2020-11-24 06:44:54 +03:00
|
|
|
should(isCronExpression('0 123 * * * *')).not.be.true();
|
2020-11-05 07:07:27 +03:00
|
|
|
should(isCronExpression('a * * * *')).not.be.true();
|
2020-11-10 03:33:01 +03:00
|
|
|
should(isCronExpression('* 13-24 * * *'), 'Invalid range should be 0-23').not.be.true();
|
2020-11-05 07:07:27 +03:00
|
|
|
});
|
|
|
|
});
|