fix(telegram): guard setMyCommands in native commands
This commit is contained in:
@@ -10,11 +10,15 @@ const sendChatActionSpy = vi.fn();
|
|||||||
type ApiStub = {
|
type ApiStub = {
|
||||||
config: { use: (arg: unknown) => void };
|
config: { use: (arg: unknown) => void };
|
||||||
sendChatAction: typeof sendChatActionSpy;
|
sendChatAction: typeof sendChatActionSpy;
|
||||||
|
setMyCommands: (
|
||||||
|
commands: Array<{ command: string; description: string }>,
|
||||||
|
) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiStub: ApiStub = {
|
const apiStub: ApiStub = {
|
||||||
config: { use: useSpy },
|
config: { use: useSpy },
|
||||||
sendChatAction: sendChatActionSpy,
|
sendChatAction: sendChatActionSpy,
|
||||||
|
setMyCommands: vi.fn(async () => undefined),
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -26,6 +30,7 @@ vi.mock("grammy", () => ({
|
|||||||
api = apiStub;
|
api = apiStub;
|
||||||
use = middlewareUseSpy;
|
use = middlewareUseSpy;
|
||||||
on = onSpy;
|
on = onSpy;
|
||||||
|
command = vi.fn();
|
||||||
stop = stopSpy;
|
stop = stopSpy;
|
||||||
constructor(public token: string) {}
|
constructor(public token: string) {}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user