























@@ -1,6 +1,5 @@
11import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
22import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
3-import { mergeMockedModule } from "../test-utils/vitest-module-mocks.js";
4354type LoadedSessionEntry = ReturnType<typeof import("./session-utils.js").loadSessionEntry>;
65type RecordInboundSessionAndDispatchReplyParams = Parameters<
@@ -158,21 +157,20 @@ vi.mock("../utils/delivery-context.shared.js", () => ({
158157}));
159158160159vi.mock("../channels/plugins/index.js", async () => {
161-return await mergeMockedModule(
162-await vi.importActual<typeof import("../channels/plugins/index.js")>(
163-"../channels/plugins/index.js",
164-),
165-(actual) => ({
166-getChannelPlugin: mocks.getChannelPlugin,
167-normalizeChannelId: mocks.normalizeChannelId.mockImplementation(
168-(channel?: string | null) =>
169-actual.normalizeChannelId(channel) ??
170-(typeof channel === "string" && channel.trim().length > 0
171- ? channel.trim().toLowerCase()
172- : null),
173-),
174-}),
160+const actual = await vi.importActual<typeof import("../channels/plugins/index.js")>(
161+"../channels/plugins/index.js",
175162);
163+return {
164+ ...actual,
165+getChannelPlugin: mocks.getChannelPlugin,
166+normalizeChannelId: mocks.normalizeChannelId.mockImplementation(
167+(channel?: string | null) =>
168+actual.normalizeChannelId(channel) ??
169+(typeof channel === "string" && channel.trim().length > 0
170+ ? channel.trim().toLowerCase()
171+ : null),
172+),
173+};
176174});
177175178176vi.mock("../infra/outbound/targets.js", () => ({
@@ -198,14 +196,13 @@ vi.mock("../plugin-sdk/inbound-reply-dispatch.js", () => ({
198196}));
199197200198vi.mock("../infra/heartbeat-wake.js", async () => {
201-return await mergeMockedModule(
202-await vi.importActual<typeof import("../infra/heartbeat-wake.js")>(
203-"../infra/heartbeat-wake.js",
204-),
205-() => ({
206-requestHeartbeatNow: mocks.requestHeartbeatNow,
207-}),
199+const actual = await vi.importActual<typeof import("../infra/heartbeat-wake.js")>(
200+"../infra/heartbeat-wake.js",
208201);
202+return {
203+ ...actual,
204+requestHeartbeatNow: mocks.requestHeartbeatNow,
205+};
209206});
210207211208vi.mock("../logging/subsystem.js", () => ({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。