From 675f36d93b71c6878092a67aabb5fb5ef69cd601 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 8 Apr 2026 13:52:42 +0100 Subject: [PATCH] test: avoid bundled test api smokes in matrix and telegram --- extensions/matrix/index.test.ts | 26 +++++-------------- .../telegram/src/thread-bindings.test.ts | 9 ------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/extensions/matrix/index.test.ts b/extensions/matrix/index.test.ts index f7b0ef98a8c..7b456a87818 100644 --- a/extensions/matrix/index.test.ts +++ b/extensions/matrix/index.test.ts @@ -1,5 +1,7 @@ import { describe, expect, it, vi } from "vitest"; import { createTestPluginApi } from "../../test/helpers/plugins/plugin-api.js"; +import { registerMatrixCliMetadata } from "./cli-metadata.js"; +import entry from "./index.js"; const cliMocks = vi.hoisted(() => ({ registerMatrixCli: vi.fn(), @@ -13,8 +15,6 @@ vi.mock("./src/cli.js", async () => { }; }); -import matrixPlugin from "./index.js"; - describe("matrix plugin", () => { it("registers matrix CLI through a descriptor-backed lazy registrar", async () => { const registerCli = vi.fn(); @@ -30,7 +30,7 @@ describe("matrix plugin", () => { registerGatewayMethod, }); - matrixPlugin.register(api); + registerMatrixCliMetadata(api); const registrar = registerCli.mock.calls[0]?.[0]; expect(registerCli).toHaveBeenCalledWith(expect.any(Function), { @@ -54,22 +54,8 @@ describe("matrix plugin", () => { }); it("keeps runtime bootstrap and CLI metadata out of setup-only registration", () => { - const registerCli = vi.fn(); - const registerGatewayMethod = vi.fn(); - const api = createTestPluginApi({ - id: "matrix", - name: "Matrix", - source: "test", - config: {}, - runtime: {} as never, - registrationMode: "setup-only", - registerCli, - registerGatewayMethod, - }); - - matrixPlugin.register(api); - - expect(registerCli).not.toHaveBeenCalled(); - expect(registerGatewayMethod).not.toHaveBeenCalled(); + expect(entry.kind).toBe("bundled-channel-entry"); + expect(entry.id).toBe("matrix"); + expect(entry.name).toBe("Matrix"); }); }); diff --git a/extensions/telegram/src/thread-bindings.test.ts b/extensions/telegram/src/thread-bindings.test.ts index 7d6803d28d9..bbb8497c853 100644 --- a/extensions/telegram/src/thread-bindings.test.ts +++ b/extensions/telegram/src/thread-bindings.test.ts @@ -3,7 +3,6 @@ import os from "node:os"; import path from "node:path"; import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime"; import { resolveStateDir } from "openclaw/plugin-sdk/state-paths"; -import { loadBundledPluginTestApiSync } from "openclaw/plugin-sdk/testing"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { importFreshModule } from "../../../test/helpers/import-fresh.js"; import { @@ -197,14 +196,6 @@ describe("telegram thread bindings", () => { ); }); - it("exposes the reset helper through the bundled test api", async () => { - const { resetTelegramThreadBindingsForTests } = loadBundledPluginTestApiSync<{ - resetTelegramThreadBindingsForTests: () => Promise; - }>("telegram"); - - await expect(resetTelegramThreadBindingsForTests()).resolves.toBeUndefined(); - }); - it("does not persist lifecycle updates when manager persistence is disabled", async () => { stateDirOverride = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-telegram-bindings-")); process.env.OPENCLAW_STATE_DIR = stateDirOverride;