fix(telegram): guard setMyCommands in native commands

This commit is contained in:
Peter Steinberger
2026-01-12 22:15:30 +00:00
parent d3eeddfc2f
commit 08fdac0561

View File

@@ -10,11 +10,15 @@ const sendChatActionSpy = vi.fn();
type ApiStub = {
config: { use: (arg: unknown) => void };
sendChatAction: typeof sendChatActionSpy;
setMyCommands: (
commands: Array<{ command: string; description: string }>,
) => Promise<void>;
};
const apiStub: ApiStub = {
config: { use: useSpy },
sendChatAction: sendChatActionSpy,
setMyCommands: vi.fn(async () => undefined),
};
beforeEach(() => {
@@ -26,6 +30,7 @@ vi.mock("grammy", () => ({
api = apiStub;
use = middlewareUseSpy;
on = onSpy;
command = vi.fn();
stop = stopSpy;
constructor(public token: string) {}
},