From 7f01c2feccb3638fabfd2e7b8be0bffabede4716 Mon Sep 17 00:00:00 2001 From: Jan-Gerke Salomon Date: Mon, 7 Nov 2022 13:20:04 +0100 Subject: [PATCH] fix(validate cron): allow ranges in fraction numerators --- src/services/validators/validate-cron.js | 4 +++- src/services/validators/validate-cron.test.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/validators/validate-cron.js b/src/services/validators/validate-cron.js index 86e46ff10..e1a80eab9 100644 --- a/src/services/validators/validate-cron.js +++ b/src/services/validators/validate-cron.js @@ -40,7 +40,9 @@ const isValidFraction = (fraction, x, y) => { /* istanbul ignore next */ return ( - (isWildcard(components[0]) || isValidNumber(components[0], x, y)) && + (isWildcard(components[0]) || + isValidNumber(components[0], x, y) || + isValidNumberRange(components[0], x, y)) && isValidNumber(components[1], x, y) ) } diff --git a/src/services/validators/validate-cron.test.js b/src/services/validators/validate-cron.test.js index 15d6fa0d1..ea34c278c 100644 --- a/src/services/validators/validate-cron.test.js +++ b/src/services/validators/validate-cron.test.js @@ -35,4 +35,8 @@ describe('validateCron', () => { it('should allow for number ranges', () => { expect(validateCron('0 0 1-5 * * *')).toEqual(true) }) + + it('should allow ranges in fraction numerators', () => { + expect(validateCron('0 0 10-22/2 ? * *')).toBe(true) + }) })