Add timezone-aware cron schedules (#1232)
* feat: add timezone-aware cron schedules * chore: normalize schedule timezone property * fix: reject blank schedule timezone in mcp * Stabilize terminal resize browser repro * Fix terminal resize repro row assertions --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
co-authored by
Mohamed Boudra
parent
922a93af2f
commit
632c48fde3
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { ScheduleCadenceSchema } from "./types.js";
|
||||
|
||||
describe("ScheduleCadenceSchema", () => {
|
||||
test("accepts existing UTC cron cadence without a time zone", () => {
|
||||
expect(ScheduleCadenceSchema.parse({ type: "cron", expression: "0 9 * * *" })).toEqual({
|
||||
type: "cron",
|
||||
expression: "0 9 * * *",
|
||||
});
|
||||
});
|
||||
|
||||
test("accepts timezone-aware cron cadence", () => {
|
||||
expect(
|
||||
ScheduleCadenceSchema.parse({
|
||||
type: "cron",
|
||||
expression: "0 9 * * *",
|
||||
timezone: "America/New_York",
|
||||
}),
|
||||
).toEqual({
|
||||
type: "cron",
|
||||
expression: "0 9 * * *",
|
||||
timezone: "America/New_York",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,7 @@ export const ScheduleCadenceSchema = z.discriminatedUnion("type", [
|
||||
z.object({
|
||||
type: z.literal("cron"),
|
||||
expression: z.string().trim().min(1),
|
||||
timezone: z.string().trim().min(1).optional(),
|
||||
}),
|
||||
]);
|
||||
export type ScheduleCadence = z.infer<typeof ScheduleCadenceSchema>;
|
||||
|
||||
Reference in New Issue
Block a user