mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 19:28:38 +00:00
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: b608be3488
Co-authored-by: akramcodez <179671552+akramcodez@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { OpenClawSchema } from "./zod-schema.js";
|
|
|
|
describe("telegram custom commands schema", () => {
|
|
it("normalizes custom commands", () => {
|
|
const res = OpenClawSchema.safeParse({
|
|
channels: {
|
|
telegram: {
|
|
customCommands: [{ command: "/Backup", description: " Git backup " }],
|
|
},
|
|
},
|
|
});
|
|
|
|
expect(res.success).toBe(true);
|
|
if (!res.success) {
|
|
return;
|
|
}
|
|
|
|
expect(res.data.channels?.telegram?.customCommands).toEqual([
|
|
{ command: "backup", description: "Git backup" },
|
|
]);
|
|
});
|
|
|
|
it("normalizes hyphens in custom command names", () => {
|
|
const res = OpenClawSchema.safeParse({
|
|
channels: {
|
|
telegram: {
|
|
customCommands: [{ command: "Bad-Name", description: "Override status" }],
|
|
},
|
|
},
|
|
});
|
|
|
|
expect(res.success).toBe(true);
|
|
if (!res.success) {
|
|
return;
|
|
}
|
|
|
|
expect(res.data.channels?.telegram?.customCommands).toEqual([
|
|
{ command: "bad_name", description: "Override status" },
|
|
]);
|
|
});
|
|
});
|