fix(telegram): sequence runner updates and cap concurrency

This commit is contained in:
Peter Steinberger
2026-01-07 21:55:52 +01:00
parent 315b0938e3
commit 068b1872fa
6 changed files with 127 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
const useSpy = vi.fn();
const middlewareUseSpy = vi.fn();
const onSpy = vi.fn();
const stopSpy = vi.fn();
const sendChatActionSpy = vi.fn();
@@ -18,6 +19,7 @@ const apiStub: ApiStub = {
vi.mock("grammy", () => ({
Bot: class {
api = apiStub;
use = middlewareUseSpy;
on = onSpy;
stop = stopSpy;
constructor(public token: string) {}
@@ -26,6 +28,10 @@ vi.mock("grammy", () => ({
webhookCallback: vi.fn(),
}));
vi.mock("@grammyjs/runner", () => ({
sequentialize: () => vi.fn(),
}));
const throttlerSpy = vi.fn(() => "throttler");
vi.mock("@grammyjs/transformer-throttler", () => ({
apiThrottler: () => throttlerSpy(),