
















@@ -395,7 +395,11 @@ describe("server-channels auto restart", () => {
395395() => hoisted.sleepWithAbort.mock.calls.length > 0,
396396"expected recovery restart backoff to be scheduled",
397397);
398-expect(hoisted.sleepWithAbort).toHaveBeenCalledWith(10, expect.any(AbortSignal));
398+const sleepCall = hoisted.sleepWithAbort.mock.calls[0] as
399+| [number, AbortSignal | undefined]
400+| undefined;
401+expect(sleepCall?.[0]).toBe(10);
402+expect(sleepCall?.[1]).toBeInstanceOf(AbortSignal);
399403400404await manager.stopChannel("discord", DEFAULT_ACCOUNT_ID);
401405await vi.advanceTimersByTimeAsync(10);
@@ -452,7 +456,9 @@ describe("server-channels auto restart", () => {
452456await manager.startChannels();
453457expect(startAccount).toHaveBeenCalledTimes(1);
454458const [ctx] = startAccount.mock.calls[0] ?? [];
455-expect(ctx?.channelRuntime).toMatchObject({ marker: "channel-runtime" });
459+expect((ctx?.channelRuntime as { marker?: string } | undefined)?.marker).toBe(
460+"channel-runtime",
461+);
456462expect(ctx?.channelRuntime).not.toBe(channelRuntime);
457463});
458464@@ -543,7 +549,9 @@ describe("server-channels auto restart", () => {
543549expect(resolveChannelRuntime).toHaveBeenCalledTimes(1);
544550expect(startAccount).toHaveBeenCalledTimes(1);
545551const [ctx] = startAccount.mock.calls[0] ?? [];
546-expect(ctx?.channelRuntime).toMatchObject({ marker: "lazy-channel-runtime" });
552+expect((ctx?.channelRuntime as { marker?: string } | undefined)?.marker).toBe(
553+"lazy-channel-runtime",
554+);
547555expect(ctx?.channelRuntime).not.toBe(channelRuntime);
548556});
549557@@ -569,7 +577,9 @@ describe("server-channels auto restart", () => {
569577expect(resolveChannelRuntime).not.toHaveBeenCalled();
570578expect(startAccount).toHaveBeenCalledTimes(1);
571579const [ctx] = startAccount.mock.calls[0] ?? [];
572-expect(ctx?.channelRuntime).toMatchObject({ marker: "startup-channel-runtime" });
580+expect((ctx?.channelRuntime as { marker?: string } | undefined)?.marker).toBe(
581+"startup-channel-runtime",
582+);
573583expect(ctx?.channelRuntime).not.toBe(startupRuntime);
574584});
575585@@ -594,7 +604,9 @@ describe("server-channels auto restart", () => {
594604expect(resolveStartupChannelRuntime).not.toHaveBeenCalled();
595605expect(resolveChannelRuntime).toHaveBeenCalledTimes(1);
596606const [ctx] = startAccount.mock.calls[0] ?? [];
597-expect(ctx?.channelRuntime).toMatchObject({ marker: "full-channel-runtime" });
607+expect((ctx?.channelRuntime as { marker?: string } | undefined)?.marker).toBe(
608+"full-channel-runtime",
609+);
598610});
599611600612it("does not resolve channelRuntime for disabled accounts", async () => {
@@ -707,14 +719,10 @@ describe("server-channels auto restart", () => {
707719await manager.startChannels();
708720709721const names = measureMock.mock.calls.map(([name]) => name);
710-expect(names).toEqual(
711-expect.arrayContaining([
712-"channels.discord.start",
713-"channels.discord.list-accounts",
714-"channels.discord.runtime",
715-"channels.discord.approval-bootstrap",
716-]),
717-);
722+expect(names).toContain("channels.discord.start");
723+expect(names).toContain("channels.discord.list-accounts");
724+expect(names).toContain("channels.discord.runtime");
725+expect(names).toContain("channels.discord.approval-bootstrap");
718726});
719727720728it("limits whole-channel account startup fanout to four", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。