mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 20:54:33 +00:00
chore: Fix types in tests 22/N.
This commit is contained in:
@@ -78,7 +78,7 @@ async function createHandler(cfg: LoadedConfig) {
|
||||
const { createDiscordMessageHandler } = await import("./monitor.js");
|
||||
return createDiscordMessageHandler({
|
||||
cfg,
|
||||
discordConfig: cfg.channels.discord,
|
||||
discordConfig: cfg.channels?.discord,
|
||||
accountId: "default",
|
||||
token: "token",
|
||||
runtime: makeRuntime(),
|
||||
@@ -90,7 +90,7 @@ async function createHandler(cfg: LoadedConfig) {
|
||||
replyToMode: "off",
|
||||
dmEnabled: true,
|
||||
groupDmEnabled: false,
|
||||
guildEntries: cfg.channels.discord.guilds,
|
||||
guildEntries: cfg.channels?.discord?.guilds,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -275,7 +275,9 @@ describe("discord tool result dispatch", () => {
|
||||
},
|
||||
},
|
||||
session: { store: "/tmp/openclaw-sessions.json" },
|
||||
discord: { dm: { enabled: true, policy: "open" } },
|
||||
channels: {
|
||||
discord: { dm: { enabled: true, policy: "open" } },
|
||||
},
|
||||
} as ReturnType<typeof import("../config/config.js").loadConfig>;
|
||||
|
||||
const command = createDiscordNativeCommand({
|
||||
@@ -285,9 +287,8 @@ describe("discord tool result dispatch", () => {
|
||||
acceptsArgs: true,
|
||||
},
|
||||
cfg,
|
||||
discordConfig: cfg.discord,
|
||||
discordConfig: cfg.channels!.discord!,
|
||||
accountId: "default",
|
||||
token: "token",
|
||||
sessionPrefix: "discord:slash",
|
||||
ephemeralDefault: true,
|
||||
});
|
||||
@@ -295,7 +296,7 @@ describe("discord tool result dispatch", () => {
|
||||
const reply = vi.fn().mockResolvedValue(undefined);
|
||||
const followUp = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
await command.run({
|
||||
const interaction = {
|
||||
user: { id: "u1", username: "Ada", globalName: "Ada" },
|
||||
channel: { type: ChannelType.DM },
|
||||
guild: null,
|
||||
@@ -303,7 +304,9 @@ describe("discord tool result dispatch", () => {
|
||||
options: { getString: vi.fn().mockReturnValue("on") },
|
||||
reply,
|
||||
followUp,
|
||||
});
|
||||
} as unknown as Parameters<typeof command.run>[0];
|
||||
|
||||
await command.run(interaction);
|
||||
|
||||
expect(dispatchMock).toHaveBeenCalledTimes(1);
|
||||
expect(reply).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user