fix(discord): use partial mock for @buape/carbon in slash test

Replace the full manual mock with importOriginal spread so new SDK
exports are available automatically. Only ChannelType, MessageType,
and Client are overridden — the rest come from the real module.

Prevents CI breakage when @buape/carbon adds exports (e.g. the
recent StringSelectMenu failure that blocked unrelated PRs).

Closes #13244
This commit is contained in:
Claude Code
2026-02-10 08:53:24 +01:00
committed by Shadow
parent 940ce424c8
commit a67752e6be

View File

@@ -3,24 +3,19 @@ import { createReplyDispatcherWithTyping } from "../auto-reply/reply/reply-dispa
const dispatchMock = vi.fn(); const dispatchMock = vi.fn();
vi.mock("@buape/carbon", () => ({ vi.mock("@buape/carbon", async (importOriginal) => {
ChannelType: { DM: "dm", GroupDM: "group" }, const actual = await importOriginal<typeof import("@buape/carbon")>();
MessageType: { return {
ChatInputCommand: 1, ...actual,
ContextMenuCommand: 2, ChannelType: { DM: "dm", GroupDM: "group" },
Default: 0, MessageType: {
}, ChatInputCommand: 1,
Button: class {}, ContextMenuCommand: 2,
Command: class {}, Default: 0,
Client: class {}, },
MessageCreateListener: class {}, Client: class {},
MessageReactionAddListener: class {}, };
MessageReactionRemoveListener: class {}, });
PresenceUpdateListener: class {},
Row: class {},
StringSelectMenu: class {},
BaseMessageInteractiveComponent: class {},
}));
vi.mock("../auto-reply/dispatch.js", async (importOriginal) => { vi.mock("../auto-reply/dispatch.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../auto-reply/dispatch.js")>(); const actual = await importOriginal<typeof import("../auto-reply/dispatch.js")>();