mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 08:21:26 +00:00
chore: Fix types in tests 39/N.
This commit is contained in:
@@ -10,6 +10,8 @@ import { attachDiscordGatewayLogging } from "./gateway-logging.js";
|
||||
|
||||
const makeRuntime = () => ({
|
||||
log: vi.fn(),
|
||||
error: vi.fn(),
|
||||
exit: vi.fn(),
|
||||
});
|
||||
|
||||
describe("attachDiscordGatewayLogging", () => {
|
||||
|
||||
@@ -46,7 +46,6 @@ const CATEGORY_GUILD_CFG = {
|
||||
},
|
||||
},
|
||||
},
|
||||
routing: { allowFrom: [] },
|
||||
} satisfies Config;
|
||||
|
||||
async function createDmHandler(opts: { cfg: Config; runtimeError?: (err: unknown) => void }) {
|
||||
|
||||
@@ -3,7 +3,13 @@ import { createBaseDiscordMessageContext } from "./message-handler.test-harness.
|
||||
|
||||
const reactMessageDiscord = vi.fn(async () => {});
|
||||
const removeReactionDiscord = vi.fn(async () => {});
|
||||
const dispatchInboundMessage = vi.fn(async () => ({
|
||||
type DispatchInboundParams = {
|
||||
replyOptions?: {
|
||||
onReasoningStream?: () => Promise<void> | void;
|
||||
onToolStart?: (payload: { name?: string }) => Promise<void> | void;
|
||||
};
|
||||
};
|
||||
const dispatchInboundMessage = vi.fn(async (_params?: DispatchInboundParams) => ({
|
||||
queuedFinal: false,
|
||||
counts: { final: 0, tool: 0, block: 0 },
|
||||
}));
|
||||
@@ -114,18 +120,11 @@ describe("processDiscordMessage ack reactions", () => {
|
||||
});
|
||||
|
||||
it("debounces intermediate phase reactions and jumps to done for short runs", async () => {
|
||||
dispatchInboundMessage.mockImplementationOnce(
|
||||
async (params: {
|
||||
replyOptions?: {
|
||||
onReasoningStream?: () => Promise<void> | void;
|
||||
onToolStart?: (payload: { name?: string }) => Promise<void> | void;
|
||||
};
|
||||
}) => {
|
||||
await params.replyOptions?.onReasoningStream?.();
|
||||
await params.replyOptions?.onToolStart?.({ name: "exec" });
|
||||
return { queuedFinal: false, counts: { final: 0, tool: 0, block: 0 } };
|
||||
},
|
||||
);
|
||||
dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {
|
||||
await params?.replyOptions?.onReasoningStream?.();
|
||||
await params?.replyOptions?.onToolStart?.({ name: "exec" });
|
||||
return { queuedFinal: false, counts: { final: 0, tool: 0, block: 0 } };
|
||||
});
|
||||
|
||||
const ctx = await createBaseContext();
|
||||
|
||||
|
||||
@@ -324,7 +324,10 @@ describe("discord component interactions", () => {
|
||||
await button.run(interaction, { cid: "btn_1" } as ComponentData);
|
||||
|
||||
const { interaction: secondInteraction } = createComponentButtonInteraction({
|
||||
rawData: { channel_id: "dm-channel", id: "interaction-2" },
|
||||
rawData: {
|
||||
channel_id: "dm-channel",
|
||||
id: "interaction-2",
|
||||
} as unknown as ButtonInteraction["rawData"],
|
||||
});
|
||||
await button.run(secondInteraction, { cid: "btn_1" } as ComponentData);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ describe("maybeCreateDiscordAutoThread", () => {
|
||||
message: mockMessage,
|
||||
messageChannelId: "forum1",
|
||||
isGuildMessage: true,
|
||||
channelConfig: { autoThread: true },
|
||||
channelConfig: { allowed: true, autoThread: true },
|
||||
channelType: ChannelType.GuildForum,
|
||||
baseText: "test",
|
||||
combinedBody: "test",
|
||||
@@ -34,7 +34,7 @@ describe("maybeCreateDiscordAutoThread", () => {
|
||||
message: mockMessage,
|
||||
messageChannelId: "media1",
|
||||
isGuildMessage: true,
|
||||
channelConfig: { autoThread: true },
|
||||
channelConfig: { allowed: true, autoThread: true },
|
||||
channelType: ChannelType.GuildMedia,
|
||||
baseText: "test",
|
||||
combinedBody: "test",
|
||||
@@ -50,7 +50,7 @@ describe("maybeCreateDiscordAutoThread", () => {
|
||||
message: mockMessage,
|
||||
messageChannelId: "text1",
|
||||
isGuildMessage: true,
|
||||
channelConfig: { autoThread: true },
|
||||
channelConfig: { allowed: true, autoThread: true },
|
||||
channelType: ChannelType.GuildText,
|
||||
baseText: "test",
|
||||
combinedBody: "test",
|
||||
|
||||
Reference in New Issue
Block a user