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();
vi.mock("@buape/carbon", () => ({
ChannelType: { DM: "dm", GroupDM: "group" },
MessageType: {
ChatInputCommand: 1,
ContextMenuCommand: 2,
Default: 0,
},
Button: class {},
Command: class {},
Client: class {},
MessageCreateListener: class {},
MessageReactionAddListener: class {},
MessageReactionRemoveListener: class {},
PresenceUpdateListener: class {},
Row: class {},
StringSelectMenu: class {},
BaseMessageInteractiveComponent: class {},
}));
vi.mock("@buape/carbon", async (importOriginal) => {
const actual = await importOriginal<typeof import("@buape/carbon")>();
return {
...actual,
ChannelType: { DM: "dm", GroupDM: "group" },
MessageType: {
ChatInputCommand: 1,
ContextMenuCommand: 2,
Default: 0,
},
Client: class {},
};
});
vi.mock("../auto-reply/dispatch.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../auto-reply/dispatch.js")>();