


















@@ -445,17 +445,16 @@ describe("monitorTelegramProvider (grammY)", () => {
445445446446await monitorWithAutoAbort();
447447448-expect(runSpy).toHaveBeenCalledWith(
449-expect.anything(),
450-expect.objectContaining({
451-sink: { concurrency: 3 },
452-runner: expect.objectContaining({
453-silent: true,
454-maxRetryTime: 60 * 60 * 1000,
455-retryInterval: "exponential",
456-}),
457-}),
458-);
448+type RunOptions = {
449+sink?: { concurrency?: number };
450+runner?: { silent?: boolean; maxRetryTime?: number; retryInterval?: string };
451+};
452+const runCall = runSpy.mock.calls.at(-1) as unknown as [unknown, RunOptions] | undefined;
453+const runOptions = runCall?.[1];
454+expect(runOptions?.sink?.concurrency).toBe(3);
455+expect(runOptions?.runner?.silent).toBe(true);
456+expect(runOptions?.runner?.maxRetryTime).toBe(60 * 60 * 1000);
457+expect(runOptions?.runner?.retryInterval).toBe("exponential");
459458});
460459461460it("requires mention in groups by default", async () => {
@@ -848,12 +847,12 @@ describe("monitorTelegramProvider (grammY)", () => {
848847},
849848});
850849851-expect(startTelegramWebhookSpy).toHaveBeenCalledWith(
852-expect.objectContaining({
853- host: "0.0.0.0",
854- setStatus,
855- }),
856-);
850+const webhookCall = startTelegramWebhookSpy.mock.calls.at(-1) as
851+| [{ host?: string; setStatus?: unknown }]
852+| undefined;
853+const webhookOptions = webhookCall?.[0];
854+expect(webhookOptions?.host).toBe("0.0.0.0");
855+expect(webhookOptions?.setStatus).toBe(setStatus);
857856expect(runSpy).not.toHaveBeenCalled();
858857});
859858@@ -1019,11 +1018,10 @@ describe("monitorTelegramProvider (grammY)", () => {
10191018},
10201019});
102110201022-expect(startTelegramWebhookSpy).toHaveBeenCalledWith(
1023-expect.objectContaining({
1024-secret: "secret-from-config",
1025-}),
1026-);
1021+const webhookCall = startTelegramWebhookSpy.mock.calls.at(-1) as
1022+| [{ secret?: string }]
1023+| undefined;
1024+expect(webhookCall?.[0]?.secret).toBe("secret-from-config");
10271025expect(runSpy).not.toHaveBeenCalled();
10281026});
10291027});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。