fix: migrate cron payload channel alias
This commit is contained in:
1 parent
bdee50da6b
commit
22b3bd4415
4 files changed
+110
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { normalizeCronJobCreate } from "./normalize.js";
|
||||
|
||||
describe("normalizeCronJobCreate", () => {
|
||||
it("maps legacy payload.channel to payload.provider and strips channel", () => {
|
||||
const normalized = normalizeCronJobCreate({
|
||||
name: "legacy",
|
||||
enabled: true,
|
||||
schedule: { kind: "cron", expr: "* * * * *" },
|
||||
sessionTarget: "isolated",
|
||||
wakeMode: "now",
|
||||
payload: {
|
||||
kind: "agentTurn",
|
||||
message: "hi",
|
||||
deliver: true,
|
||||
channel: "telegram",
|
||||
to: "7200373102",
|
||||
},
|
||||
}) as unknown as Record<string, unknown>;
|
||||
|
||||
const payload = normalized.payload as Record<string, unknown>;
|
||||
expect(payload.provider).toBe("telegram");
|
||||
expect("channel" in payload).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user