@clausehq/flows-analysis
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -14,11 +14,2 @@ const { validation } = require('../index'); | ||
}); | ||
test('scheduled trigger flow, to be ran once, in a 10 years (human interval)', () => { | ||
expect(validation.triggerType( | ||
{ | ||
$class: 'io.clause.flows.trigger.Schedule', | ||
type: 'once', | ||
interval: '10 years' | ||
} | ||
)).toBe(true); | ||
}); | ||
test('scheduled trigger flow, to be ran once, in a 0 minutes (human interval)', () => { | ||
@@ -158,2 +149,11 @@ expect(validation.triggerType( | ||
}); | ||
test('scheduled trigger flow, to be ran periodically, with an interval that is valid in human interval, but invalid for our subset', () => { | ||
expect(() => validation.triggerType( | ||
{ | ||
$class: 'io.clause.flows.trigger.Schedule', | ||
type: 'periodic', | ||
interval: '5 months' | ||
} | ||
)).toThrow(); | ||
}); | ||
test('scheduled trigger flow, to be ran periodically, every 5 minutes (CRON)', () => { | ||
@@ -160,0 +160,0 @@ expect(() => validation.triggerType( |
@@ -22,5 +22,3 @@ const humanInterval = require('human-interval'); | ||
); | ||
const isHumanIntervalValid = humanIntervalString => !Number.isNaN( | ||
humanInterval(humanIntervalString) | ||
); | ||
const isHumanIntervalValid = humanIntervalString => /^-?[0-9]+([.,][0-9]*)?\s(second(s)?|minute(s)|hour(s)|day(s))$/.test(humanIntervalString); | ||
const isIso8601Valid = iso8601String => dayjs(iso8601String).isValid(); | ||
@@ -63,3 +61,3 @@ const isCronExpressionValid = cronExpressionString => { | ||
throw buildValidationError( | ||
`Invalid scheduled flow once-off interval: ${interval}. Please use either the Human Interval format or an ISO 8601 string.` | ||
`Invalid scheduled flow once-off interval: ${interval}. Please use either the \`<amount> <seconds, minutes, hours or days>\` format or an ISO 8601 string.` | ||
); | ||
@@ -88,3 +86,3 @@ }; | ||
throw buildValidationError( | ||
`Invalid scheduled flow periodic interval: ${interval}. Please use either the Human Interval format or a CRON expression.` | ||
`Invalid scheduled flow periodic interval: ${interval}. Please use either the \`<amount> <seconds, minutes, hours or days>\` format or a CRON expression.` | ||
); | ||
@@ -91,0 +89,0 @@ }; |
{ | ||
"name": "@clausehq/flows-analysis", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A utility for doing static analysis on flows", | ||
@@ -5,0 +5,0 @@ "license": "UNLICENSED", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22435
609