Files
openclaw/src/config/zod-schema.cron-retention.test.ts
Gustavo Madeira Santana eff3c5c707 Session/Cron maintenance hardening and cleanup UX (#24753)
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 7533b85156
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com>
Reviewed-by: @shakkernerd
2026-02-23 22:39:48 +00:00

41 lines
952 B
TypeScript

import { describe, expect, it } from "vitest";
import { OpenClawSchema } from "./zod-schema.js";
describe("OpenClawSchema cron retention and run-log validation", () => {
it("accepts valid cron.sessionRetention and runLog values", () => {
expect(() =>
OpenClawSchema.parse({
cron: {
sessionRetention: "1h30m",
runLog: {
maxBytes: "5mb",
keepLines: 2500,
},
},
}),
).not.toThrow();
});
it("rejects invalid cron.sessionRetention", () => {
expect(() =>
OpenClawSchema.parse({
cron: {
sessionRetention: "abc",
},
}),
).toThrow(/sessionRetention|duration/i);
});
it("rejects invalid cron.runLog.maxBytes", () => {
expect(() =>
OpenClawSchema.parse({
cron: {
runLog: {
maxBytes: "wat",
},
},
}),
).toThrow(/runLog|maxBytes|size/i);
});
});