diff options
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/cron_test.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cli/tests/unit/cron_test.ts b/cli/tests/unit/cron_test.ts index 8408acf45..ed4500624 100644 --- a/cli/tests/unit/cron_test.ts +++ b/cli/tests/unit/cron_test.ts @@ -297,13 +297,13 @@ Deno.test(async function retriesWithBackoffScheduleOldApi() { let count = 0; const ac = new AbortController(); - const c = Deno.cron("abc2", "*/20 * * * *", async () => { + const c = Deno.cron("abc2", "*/20 * * * *", { + signal: ac.signal, + backoffSchedule: [10, 20], + }, async () => { count += 1; await sleep(10); throw new TypeError("cron error"); - }, { - signal: ac.signal, - backoffSchedule: [10, 20], }); try { @@ -380,3 +380,14 @@ Deno.test("Parse schedule to string - string", () => { const result = parseScheduleToString("* * * * *"); assertEquals(result, "* * * * *"); }); + +Deno.test("error on two handlers", () => { + assertThrows( + () => { + // @ts-ignore test + Deno.cron("abc", "* * * * *", () => {}, () => {}); + }, + TypeError, + "Deno.cron requires a single handler", + ); +}); |