



















@@ -56,6 +56,15 @@ vi.mock("../gateway/call.js", () => ({
5656callGateway: (...args: unknown[]) => callGatewayMock(...args),
5757}));
585859+function requireFirstRuntimeLog(): string {
60+const [message] = runtime.log.mock.calls[0] ?? [];
61+expect(message).toBeDefined();
62+if (message === undefined) {
63+throw new Error("expected health command log output");
64+}
65+return String(message);
66+}
67+5968describe("healthCommand", () => {
6069beforeEach(() => {
6170vi.clearAllMocks();
@@ -90,8 +99,7 @@ describe("healthCommand", () => {
9099await healthCommand({ json: true, timeoutMs: 5000, config: {} }, runtime as never);
9110092101expect(runtime.exit).not.toHaveBeenCalled();
93-const logged = runtime.log.mock.calls[0]?.[0] as string;
94-const parsed = JSON.parse(logged) as HealthSummary;
102+const parsed = JSON.parse(requireFirstRuntimeLog()) as HealthSummary;
95103expect(parsed.channels.whatsapp?.linked).toBe(true);
96104expect(parsed.channels.telegram?.configured).toBe(true);
97105expect(parsed.sessions.count).toBe(1);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。