mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:07:41 +00:00
fix(heartbeat): telegram accountId + cron jobId compat (#516, thanks @YuriNachos)
This commit is contained in:
@@ -19,9 +19,17 @@ describe("cron tool", () => {
|
||||
{ action: "update", jobId: "job-1", patch: { foo: "bar" } },
|
||||
{ id: "job-1", patch: { foo: "bar" } },
|
||||
],
|
||||
[
|
||||
"update",
|
||||
{ action: "update", id: "job-2", patch: { foo: "bar" } },
|
||||
{ id: "job-2", patch: { foo: "bar" } },
|
||||
],
|
||||
["remove", { action: "remove", jobId: "job-1" }, { id: "job-1" }],
|
||||
["remove", { action: "remove", id: "job-2" }, { id: "job-2" }],
|
||||
["run", { action: "run", jobId: "job-1" }, { id: "job-1" }],
|
||||
["run", { action: "run", id: "job-2" }, { id: "job-2" }],
|
||||
["runs", { action: "runs", jobId: "job-1" }, { id: "job-1" }],
|
||||
["runs", { action: "runs", id: "job-2" }, { id: "job-2" }],
|
||||
])("%s sends id to gateway", async (action, args, expectedParams) => {
|
||||
const tool = createCronTool();
|
||||
await tool.execute("call1", args);
|
||||
@@ -35,6 +43,20 @@ describe("cron tool", () => {
|
||||
expect(call.params).toEqual(expectedParams);
|
||||
});
|
||||
|
||||
it("prefers jobId over id when both are provided", async () => {
|
||||
const tool = createCronTool();
|
||||
await tool.execute("call1", {
|
||||
action: "run",
|
||||
jobId: "job-primary",
|
||||
id: "job-legacy",
|
||||
});
|
||||
|
||||
const call = callGatewayMock.mock.calls[0]?.[0] as {
|
||||
params?: unknown;
|
||||
};
|
||||
expect(call?.params).toEqual({ id: "job-primary" });
|
||||
});
|
||||
|
||||
it("normalizes cron.add job payloads", async () => {
|
||||
const tool = createCronTool();
|
||||
await tool.execute("call2", {
|
||||
|
||||
Reference in New Issue
Block a user