chore: Fix types in tests 39/N.

This commit is contained in:
cpojer
2026-02-17 15:47:58 +09:00
parent 084e39b519
commit c4bd82d81d
11 changed files with 59 additions and 31 deletions

View File

@@ -10,6 +10,8 @@ import { attachDiscordGatewayLogging } from "./gateway-logging.js";
const makeRuntime = () => ({
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
});
describe("attachDiscordGatewayLogging", () => {

View File

@@ -46,7 +46,6 @@ const CATEGORY_GUILD_CFG = {
},
},
},
routing: { allowFrom: [] },
} satisfies Config;
async function createDmHandler(opts: { cfg: Config; runtimeError?: (err: unknown) => void }) {

View File

@@ -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();

View File

@@ -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);

View File

@@ -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",