

























@@ -18,12 +18,16 @@ const mocks = vi.hoisted(() => ({
1818listReadOnlyChannelPluginsForConfig: vi.fn(),
1919}));
202021-vi.mock("./shared.js", () => ({
22-requireValidConfig: vi.fn(async () => ({ channels: {} })),
23-formatChannelAccountLabel: vi.fn(
24-({ channel, accountId }: { channel: string; accountId: string }) => `${channel}:${accountId}`,
25-),
26-}));
21+vi.mock("./shared.js", async () => {
22+const actual = await vi.importActual<typeof import("./shared.js")>("./shared.js");
23+return {
24+ ...actual,
25+requireValidConfig: vi.fn(async () => ({ channels: {} })),
26+formatChannelAccountLabel: vi.fn(
27+({ channel, accountId }: { channel: string; accountId: string }) => `${channel}:${accountId}`,
28+),
29+};
30+});
27312832vi.mock("../../channels/plugins/index.js", () => ({
2933listChannelPlugins: vi.fn(),
@@ -242,9 +246,7 @@ describe("channelsCapabilitiesCommand", () => {
242246243247await channelsCapabilitiesCommand({ channel: "slack", timeout: "999999" }, runtime);
244248245-expect(probeAccount).toHaveBeenCalledWith(
246-expect.objectContaining({ timeoutMs: 30_000 }),
247-);
249+expect(probeAccount).toHaveBeenCalledWith(expect.objectContaining({ timeoutMs: 30_000 }));
248250expect(buildCapabilitiesDiagnostics).toHaveBeenCalledWith(
249251expect.objectContaining({ timeoutMs: 30_000 }),
250252);
@@ -274,10 +276,7 @@ describe("channelsCapabilitiesCommand", () => {
274276configChanged: false,
275277});
276278277-await channelsCapabilitiesCommand(
278-{ channel: "slack", json: true, timeout: "1" },
279-runtime,
280-);
279+await channelsCapabilitiesCommand({ channel: "slack", json: true, timeout: "1" }, runtime);
281280282281const payload = JSON.parse(logs[0] ?? "{}") as {
283282channels?: Array<{ probe?: unknown }>;
@@ -343,10 +342,7 @@ describe("channelsCapabilitiesCommand", () => {
343342configChanged: false,
344343});
345344346-await channelsCapabilitiesCommand(
347-{ channel: "slack", json: true, timeout: "1" },
348-runtime,
349-);
345+await channelsCapabilitiesCommand({ channel: "slack", json: true, timeout: "1" }, runtime);
350346351347const payload = JSON.parse(logs[0] ?? "{}") as {
352348channels?: Array<{ diagnostics?: unknown }>;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。