mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 16:44:45 +00:00
test: tighten command json assertions
This commit is contained in:
@@ -314,9 +314,12 @@ describe("channels list", () => {
|
||||
const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] as string) as {
|
||||
chat: Record<string, { origin: string; installed: boolean }>;
|
||||
};
|
||||
expect(payload.chat.telegram).toMatchObject({ origin: "configured", installed: true });
|
||||
expect(payload.chat.discord).toMatchObject({ origin: "available", installed: true });
|
||||
expect(payload.chat.qqbot).toMatchObject({ origin: "installable", installed: false });
|
||||
expect(payload.chat.telegram?.origin).toBe("configured");
|
||||
expect(payload.chat.telegram?.installed).toBe(true);
|
||||
expect(payload.chat.discord?.origin).toBe("available");
|
||||
expect(payload.chat.discord?.installed).toBe(true);
|
||||
expect(payload.chat.qqbot?.origin).toBe("installable");
|
||||
expect(payload.chat.qqbot?.installed).toBe(false);
|
||||
});
|
||||
|
||||
it(
|
||||
@@ -355,10 +358,8 @@ describe("channels list", () => {
|
||||
const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] as string) as {
|
||||
chat: Record<string, { origin: string; installed: boolean }>;
|
||||
};
|
||||
expect(payload.chat.wecom).toMatchObject({
|
||||
origin: "available",
|
||||
installed: true,
|
||||
});
|
||||
expect(payload.chat.wecom?.origin).toBe("available");
|
||||
expect(payload.chat.wecom?.installed).toBe(true);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -98,25 +98,15 @@ describe("flows commands", () => {
|
||||
}>;
|
||||
};
|
||||
|
||||
expect(payload).toMatchObject({
|
||||
count: 1,
|
||||
status: "blocked",
|
||||
flows: [
|
||||
{
|
||||
flowId: flow.flowId,
|
||||
taskSummary: {
|
||||
total: 1,
|
||||
active: 1,
|
||||
},
|
||||
tasks: [
|
||||
{
|
||||
runId: "run-child-1",
|
||||
label: "Inspect PR 123",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(payload.count).toBe(1);
|
||||
expect(payload.status).toBe("blocked");
|
||||
expect(payload.flows).toHaveLength(1);
|
||||
expect(payload.flows[0]?.flowId).toBe(flow.flowId);
|
||||
expect(payload.flows[0]?.taskSummary.total).toBe(1);
|
||||
expect(payload.flows[0]?.taskSummary.active).toBe(1);
|
||||
expect(payload.flows[0]?.tasks).toHaveLength(1);
|
||||
expect(payload.flows[0]?.tasks[0]?.runId).toBe("run-child-1");
|
||||
expect(payload.flows[0]?.tasks[0]?.label).toBe("Inspect PR 123");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -82,14 +82,13 @@ describe("tasks JSON commands", () => {
|
||||
status: string | null;
|
||||
tasks: Array<{ runtime: string; status: string; runId: string }>;
|
||||
};
|
||||
expect(payload).toMatchObject({
|
||||
count: 1,
|
||||
runtime: "cli",
|
||||
status: "running",
|
||||
});
|
||||
expect(payload.tasks).toEqual([
|
||||
expect.objectContaining({ runtime: "cli", status: "running", runId: "run-cli" }),
|
||||
]);
|
||||
expect(payload.count).toBe(1);
|
||||
expect(payload.runtime).toBe("cli");
|
||||
expect(payload.status).toBe("running");
|
||||
expect(payload.tasks).toHaveLength(1);
|
||||
expect(payload.tasks[0]?.runtime).toBe("cli");
|
||||
expect(payload.tasks[0]?.status).toBe("running");
|
||||
expect(payload.tasks[0]?.runId).toBe("run-cli");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,13 +147,10 @@ describe("tasks JSON commands", () => {
|
||||
expect(payload.summary.taskFlows.byCode.stale_waiting).toBe(1);
|
||||
expect(payload.summary.taskFlows.byCode.missing_linked_tasks).toBe(2);
|
||||
expect(payload.summary.combined).toEqual({ total: 5, errors: 3, warnings: 2 });
|
||||
expect(payload.findings).toEqual([
|
||||
expect.objectContaining({
|
||||
kind: "task_flow",
|
||||
code: "stale_running",
|
||||
token: runningFlow.flowId,
|
||||
}),
|
||||
]);
|
||||
expect(payload.findings).toHaveLength(1);
|
||||
expect(payload.findings[0]?.kind).toBe("task_flow");
|
||||
expect(payload.findings[0]?.code).toBe("stale_running");
|
||||
expect(payload.findings[0]?.token).toBe(runningFlow.flowId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user