diff --git a/extensions/telegram/src/bot.test.ts b/extensions/telegram/src/bot.test.ts index 2c6840ac445..9468f64c789 100644 --- a/extensions/telegram/src/bot.test.ts +++ b/extensions/telegram/src/bot.test.ts @@ -1,11 +1,12 @@ import { rm } from "node:fs/promises"; import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import { escapeRegExp, formatEnvelopeTimestamp } from "../../../test/helpers/envelope-timestamp.js"; -import { expectInboundContextContract } from "../../../test/helpers/inbound-contract.js"; import { clearPluginInteractiveHandlers, registerPluginInteractiveHandler, -} from "../plugins/interactive.js"; +} from "../../../src/plugins/interactive.js"; +import type { PluginInteractiveTelegramHandlerContext } from "../../../src/plugins/types.js"; +import { escapeRegExp, formatEnvelopeTimestamp } from "../../../test/helpers/envelope-timestamp.js"; +import { expectInboundContextContract } from "../../../test/helpers/inbound-contract.js"; import { answerCallbackQuerySpy, commandSpy, @@ -1373,7 +1374,7 @@ describe("createTelegramBot", () => { registerPluginInteractiveHandler("codex-plugin", { channel: "telegram", namespace: "codex", - handler: async ({ respond, callback }) => { + handler: async ({ respond, callback }: PluginInteractiveTelegramHandlerContext) => { await respond.editMessage({ text: `Handled ${callback.payload}`, }); diff --git a/extensions/test-utils/plugin-api.ts b/extensions/test-utils/plugin-api.ts index 5c9693c1a80..a757344bd31 100644 --- a/extensions/test-utils/plugin-api.ts +++ b/extensions/test-utils/plugin-api.ts @@ -14,6 +14,7 @@ export function createTestPluginApi(api: TestPluginApiInput): OpenClawPluginApi registerCli() {}, registerService() {}, registerProvider() {}, + registerInteractiveHandler() {}, registerCommand() {}, registerContextEngine() {}, resolvePath(input: string) { diff --git a/src/auto-reply/reply/dispatch-from-config.test.ts b/src/auto-reply/reply/dispatch-from-config.test.ts index 680450bfe50..ddbbbf5eb78 100644 --- a/src/auto-reply/reply/dispatch-from-config.test.ts +++ b/src/auto-reply/reply/dispatch-from-config.test.ts @@ -42,7 +42,14 @@ const acpMocks = vi.hoisted(() => ({ })); const sessionBindingMocks = vi.hoisted(() => ({ listBySession: vi.fn<(targetSessionKey: string) => SessionBindingRecord[]>(() => []), - resolveByConversation: vi.fn(() => null), + resolveByConversation: vi.fn< + (ref: { + channel: string; + accountId: string; + conversationId: string; + parentConversationId?: string; + }) => SessionBindingRecord | null + >(() => null), touch: vi.fn(), })); const sessionStoreMocks = vi.hoisted(() => ({ diff --git a/src/plugins/conversation-binding.test.ts b/src/plugins/conversation-binding.test.ts index a5bcc81d2e5..7380adefca5 100644 --- a/src/plugins/conversation-binding.test.ts +++ b/src/plugins/conversation-binding.test.ts @@ -449,7 +449,11 @@ describe("plugin conversation binding approvals", () => { } return approved.binding; }) - : request.binding; + : request.status === "bound" + ? request.binding + : (() => { + throw new Error("expected pending or bound bind result"); + })(); expect(binding).toEqual( expect.objectContaining({ @@ -506,7 +510,11 @@ describe("plugin conversation binding approvals", () => { } return approved.binding; }) - : request.binding; + : request.status === "bound" + ? request.binding + : (() => { + throw new Error("expected pending or bound bind result"); + })(); expect(binding).toEqual( expect.objectContaining({