






























@@ -495,52 +495,37 @@ describe("monitorTelegramProvider (grammY)", () => {
495495expect(order).toEqual(["deleteWebhook", "run"]);
496496});
497497498-it("retries recoverable deleteWebhook failures before polling", async () => {
498+it("starts polling after recoverable deleteWebhook failures", async () => {
499499const abort = new AbortController();
500500const cleanupError = makeRecoverableFetchError();
501501api.deleteWebhook.mockReset();
502-api.getWebhookInfo.mockReset().mockResolvedValueOnce({ url: "https://example.test/hook" });
503-api.deleteWebhook.mockRejectedValueOnce(cleanupError).mockResolvedValueOnce(true);
502+api.getWebhookInfo.mockReset();
503+api.deleteWebhook.mockRejectedValueOnce(cleanupError);
504504mockRunOnceAndAbort(abort);
505505506506await monitorTelegramProvider({ token: "tok", abortSignal: abort.signal });
507507508-expect(api.deleteWebhook).toHaveBeenCalledTimes(2);
509-expect(api.getWebhookInfo).toHaveBeenCalledTimes(1);
508+expect(api.deleteWebhook).toHaveBeenCalledTimes(1);
509+expect(api.getWebhookInfo).not.toHaveBeenCalled();
510510expectRecoverableRetryState(1);
511511});
512512513-it("continues polling when deleteWebhook transiently fails but webhook is already absent", async () => {
513+it("does not run webhook confirmation when deleteWebhook transiently fails", async () => {
514514const abort = new AbortController();
515515const cleanupError = makeRecoverableFetchError();
516516api.deleteWebhook.mockReset();
517-api.getWebhookInfo.mockReset().mockResolvedValueOnce({ url: "" });
517+api.getWebhookInfo.mockReset();
518518api.deleteWebhook.mockRejectedValueOnce(cleanupError);
519519mockRunOnceAndAbort(abort);
520520521521await monitorTelegramProvider({ token: "tok", abortSignal: abort.signal });
522522523523expect(api.deleteWebhook).toHaveBeenCalledTimes(1);
524-expect(api.getWebhookInfo).toHaveBeenCalledTimes(1);
524+expect(api.getWebhookInfo).not.toHaveBeenCalled();
525525expect(runSpy).toHaveBeenCalledTimes(1);
526526expect(sleepWithAbort).not.toHaveBeenCalled();
527527});
528528529-it("retries cleanup when deleteWebhook and webhook confirmation both transiently fail", async () => {
530-const abort = new AbortController();
531-const cleanupError = makeRecoverableFetchError();
532-api.deleteWebhook.mockReset();
533-api.getWebhookInfo.mockReset().mockRejectedValueOnce(makeRecoverableFetchError());
534-api.deleteWebhook.mockRejectedValueOnce(cleanupError).mockResolvedValueOnce(true);
535-mockRunOnceAndAbort(abort);
536-537-await monitorTelegramProvider({ token: "tok", abortSignal: abort.signal });
538-539-expect(api.deleteWebhook).toHaveBeenCalledTimes(2);
540-expect(api.getWebhookInfo).toHaveBeenCalledTimes(1);
541-expectRecoverableRetryState(1);
542-});
543-544529it("retries setup-time recoverable errors before starting polling", async () => {
545530const abort = new AbortController();
546531const setupError = makeRecoverableFetchError();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。