fix(telegram): guard setMyCommands in native commands
This commit is contained in:
@@ -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) {}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user