Skip to content

Commit cc1ecda

Browse files
committed
docs: correct cronValidate options
1 parent 8d49eba commit cc1ecda

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ const bree = new Bree({
182182
// runs `./jobs/worker-4.js` at 10:15am every weekday
183183
{
184184
name: 'worker-4',
185-
cron: '15 10 ? * *'
185+
cron: '15 10 ? * *',
186+
cronValidate: {
187+
useBlankDay: true
188+
}
186189
},
187190

188191
// runs `./jobs/worker-5.js` on after 10 minutes have elapsed
@@ -228,7 +231,10 @@ const bree = new Bree({
228231
// runs `./jobs/worker-11.js` at midnight on the last day of month
229232
{
230233
name: 'worker-11',
231-
cron: '0 0 L * *'
234+
cron: '0 0 L * *',
235+
cronValidate: {
236+
useLastDayOfMonth: true
237+
}
232238
},
233239

234240
// runs `./jobs/worker-12.js` at a specific Date (e.g. in 3 days)

test/job-validator.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ test("prefers job's cronValidate configuration", (t) => {
9797
t.deepEqual(returned, expected);
9898
});
9999

100-
test("prefers confg's cronValidate if none in job configuration", (t) => {
100+
test("prefers config's cronValidate if none in job configuration", (t) => {
101101
const job = {};
102102

103103
const config = {
@@ -315,6 +315,20 @@ test('does not throw for valid cron without seconds', (t) => {
315315
);
316316
});
317317

318+
test('does not throw for valid cron with "L" in week', (t) => {
319+
t.notThrows(() =>
320+
jobValidator({ name: 'basic', cron: '* * * L *' }, 0, ['exists'], {
321+
root,
322+
defaultExtension: 'js',
323+
cronValidate: {
324+
override: {
325+
useLastDayOfWeek: true
326+
}
327+
}
328+
})
329+
);
330+
});
331+
318332
test('does not throw for valid cron with seconds', (t) => {
319333
t.notThrows(() =>
320334
jobValidator(

0 commit comments

Comments
 (0)