From 8caef5d0ea85f21ffc7c92e5729180ae67129e0c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 12:27:33 +0100 Subject: [PATCH] test: clarify cron job accepted paths --- src/cron/service.jobs.test.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/cron/service.jobs.test.ts b/src/cron/service.jobs.test.ts index 6a6085e2c37..fb4556c7b7d 100644 --- a/src/cron/service.jobs.test.ts +++ b/src/cron/service.jobs.test.ts @@ -59,7 +59,7 @@ describe("applyJobPatch", () => { to: "123", }); - expect(() => applyJobPatch(job, switchToMainPatch())).not.toThrow(); + applyJobPatch(job, switchToMainPatch()); expect(job.sessionTarget).toBe("main"); expect(job.payload.kind).toBe("systemEvent"); expect(job.delivery).toBeUndefined(); @@ -71,7 +71,7 @@ describe("applyJobPatch", () => { to: "https://example.invalid/cron", }); - expect(() => applyJobPatch(job, switchToMainPatch())).not.toThrow(); + applyJobPatch(job, switchToMainPatch()); expect(job.sessionTarget).toBe("main"); expect(job.delivery).toEqual({ mode: "webhook", to: "https://example.invalid/cron" }); }); @@ -92,7 +92,7 @@ describe("applyJobPatch", () => { }, }; - expect(() => applyJobPatch(job, patch)).not.toThrow(); + applyJobPatch(job, patch); expect(job.payload.kind).toBe("agentTurn"); if (job.payload.kind === "agentTurn") { expect(job.payload.message).toBe("do it"); @@ -391,7 +391,7 @@ describe("applyJobPatch", () => { to: " https://example.invalid/failure ", }, }; - expect(() => applyJobPatch(job, { enabled: true })).not.toThrow(); + applyJobPatch(job, { enabled: true }); expect(job.delivery?.failureDestination?.to).toBe("https://example.invalid/failure"); }); @@ -402,7 +402,7 @@ describe("applyJobPatch", () => { to: "-10012345/6789", }); - expect(() => applyJobPatch(job, { enabled: true })).not.toThrow(); + applyJobPatch(job, { enabled: true }); expect(job.delivery?.to).toBe("-10012345/6789"); }); @@ -421,7 +421,8 @@ describe("applyJobPatch", () => { ...(to ? { to } : {}), }); - expect(() => applyJobPatch(job, { enabled: true })).not.toThrow(); + applyJobPatch(job, { enabled: true }); + expect(job.enabled).toBe(true); }); }); @@ -453,7 +454,8 @@ describe("createJob rejects sessionTarget main for non-default agents", () => { { name: "case-insensitive defaultAgentId match", defaultAgentId: "Main", agentId: "MAIN" }, ] as const)("allows creating a main-session job for $name", ({ defaultAgentId, agentId }) => { const state = createMockState(now, { defaultAgentId }); - expect(() => createJob(state, mainJobInput(agentId))).not.toThrow(); + const job = createJob(state, mainJobInput(agentId)); + expect(job.sessionTarget).toBe("main"); }); it.each([ @@ -544,7 +546,8 @@ describe("applyJobPatch rejects sessionTarget main for non-default agents", () = ); return; } - expect(() => applyJobPatch(job, patch, { defaultAgentId: "main" })).not.toThrow(); + applyJobPatch(job, patch, { defaultAgentId: "main" }); + expect(job.agentId).toBe("main"); }); it("rejects patching to a custom session target with path separators", () => { @@ -941,7 +944,7 @@ describe("recomputeNextRuns", () => { store: { version: 1 as const, jobs: [job] }, } as CronServiceState; - expect(() => recomputeNextRunsForMaintenance(state)).not.toThrow(); + recomputeNextRunsForMaintenance(state); expect(job.state.nextRunAtMs).toBe(future); expect(job.state.scheduleErrorCount).toBeUndefined(); });