mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 22:44:47 +00:00
test: specify telegram command menu registrations
This commit is contained in:
@@ -129,7 +129,11 @@ describe("createTelegramBot command menu", () => {
|
||||
command: normalizeTelegramCommandName(command.name),
|
||||
description: command.description,
|
||||
}));
|
||||
expect(registered.slice(0, native.length)).toEqual(native);
|
||||
expect(registered).toStrictEqual([
|
||||
...native,
|
||||
{ command: "custom_backup", description: "Git backup" },
|
||||
{ command: "custom_generate", description: "Create an image" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("ignores custom commands that collide with native commands", async () => {
|
||||
@@ -170,7 +174,7 @@ describe("createTelegramBot command menu", () => {
|
||||
|
||||
await commandsSynced;
|
||||
|
||||
const registered = setMyCommandsSpy.mock.calls[0]?.[0] as Array<{
|
||||
const registered = setMyCommandsSpy.mock.calls.at(-1)?.[0] as Array<{
|
||||
command: string;
|
||||
description: string;
|
||||
}>;
|
||||
@@ -183,7 +187,10 @@ describe("createTelegramBot command menu", () => {
|
||||
if (!nativeStatus) {
|
||||
throw new Error("expected native Telegram status command");
|
||||
}
|
||||
expect(registered).toContainEqual({ command: "custom_backup", description: "Git backup" });
|
||||
expect(registered).toStrictEqual([
|
||||
...native,
|
||||
{ command: "custom_backup", description: "Git backup" },
|
||||
]);
|
||||
expect(registered).not.toContainEqual({ command: "status", description: "Custom status" });
|
||||
expect(registered.find((command) => command.command === "status")).toEqual(nativeStatus);
|
||||
expect(countMatching(registered, (command) => command.command === "status")).toBe(1);
|
||||
|
||||
Reference in New Issue
Block a user