mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
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:
@@ -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")>();
|
||||
|
||||
Reference in New Issue
Block a user