
























@@ -136,7 +136,7 @@ describe("evaluateChannelHealth", () => {
136136expect(evaluation).toEqual({ healthy: false, reason: "stale-socket" });
137137});
138138139-it("flags stale sockets for telegram polling channels", () => {
139+it("flags stale sockets for channels with an allowed health-check mode", () => {
140140const evaluation = evaluateChannelHealth(
141141{
142142running: true,
@@ -148,16 +148,17 @@ describe("evaluateChannelHealth", () => {
148148mode: "polling",
149149},
150150{
151-channelId: "telegram",
151+channelId: "example",
152152now: 100_000,
153153channelConnectGraceMs: 10_000,
154154staleEventThresholdMs: 30_000,
155+staleSocketHealthCheckModes: ["polling"],
155156},
156157);
157158expect(evaluation).toEqual({ healthy: false, reason: "stale-socket" });
158159});
159160160-it("skips stale-socket detection for telegram accounts without explicit polling mode", () => {
161+it("skips stale-socket detection when an allowlisted health-check mode is missing", () => {
161162const evaluation = evaluateChannelHealth(
162163{
163164running: true,
@@ -168,16 +169,17 @@ describe("evaluateChannelHealth", () => {
168169lastEventAt: 0,
169170},
170171{
171-channelId: "telegram",
172+channelId: "example",
172173now: 100_000,
173174channelConnectGraceMs: 10_000,
174175staleEventThresholdMs: 30_000,
176+staleSocketHealthCheckModes: ["polling"],
175177},
176178);
177179expect(evaluation).toEqual({ healthy: true, reason: "healthy" });
178180});
179181180-it("skips stale-socket detection for telegram accounts with malformed mode", () => {
182+it("skips stale-socket detection when the health-check mode is malformed", () => {
181183const evaluation = evaluateChannelHealth(
182184{
183185running: true,
@@ -189,10 +191,11 @@ describe("evaluateChannelHealth", () => {
189191mode: { polling: true } as unknown as string,
190192},
191193{
192-channelId: "telegram",
194+channelId: "example",
193195now: 100_000,
194196channelConnectGraceMs: 10_000,
195197staleEventThresholdMs: 30_000,
198+staleSocketHealthCheckModes: ["polling"],
196199},
197200);
198201expect(evaluation).toEqual({ healthy: true, reason: "healthy" });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。