From 7fa0c76ffc6d0b0675a8fb86c7a4b89d0f1b520d Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 3 Apr 2026 21:20:35 +0900 Subject: [PATCH] test(mattermost): slim leaf runtime fixtures --- .../mattermost/src/mattermost/interactions.test.ts | 14 ++++++-------- .../src/mattermost/reply-delivery.test.ts | 7 +++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/extensions/mattermost/src/mattermost/interactions.test.ts b/extensions/mattermost/src/mattermost/interactions.test.ts index ee77058eb78..c13d5afe763 100644 --- a/extensions/mattermost/src/mattermost/interactions.test.ts +++ b/extensions/mattermost/src/mattermost/interactions.test.ts @@ -1,6 +1,6 @@ import { type IncomingMessage, type ServerResponse } from "node:http"; import { describe, expect, it, beforeEach, afterEach, vi } from "vitest"; -import { createPluginRuntimeMock } from "../../../../test/helpers/plugins/plugin-runtime-mock.js"; +import type { PluginRuntime } from "../../runtime-api.js"; import { setMattermostRuntime } from "../runtime.js"; import { resolveMattermostAccount } from "./accounts.js"; import type { MattermostClient, MattermostPost } from "./client.js"; @@ -441,13 +441,11 @@ describe("createMattermostInteractionHandler", () => { options: { sessionKey?: string | null; sessionId?: string | null; userId?: string | null }, ) => boolean = () => true, ) { - setMattermostRuntime( - createPluginRuntimeMock({ - system: { - enqueueSystemEvent, - }, - }), - ); + setMattermostRuntime({ + system: { + enqueueSystemEvent, + }, + } as unknown as PluginRuntime); } function createMattermostClientMock( diff --git a/extensions/mattermost/src/mattermost/reply-delivery.test.ts b/extensions/mattermost/src/mattermost/reply-delivery.test.ts index 80fe5db0c3a..d702b44e2d4 100644 --- a/extensions/mattermost/src/mattermost/reply-delivery.test.ts +++ b/extensions/mattermost/src/mattermost/reply-delivery.test.ts @@ -3,8 +3,7 @@ import os from "node:os"; import path from "node:path"; import type { ChunkMode } from "openclaw/plugin-sdk/reply-runtime"; import { describe, expect, it, vi } from "vitest"; -import { createPluginRuntimeMock } from "../../../../test/helpers/plugins/plugin-runtime-mock.js"; -import type { OpenClawConfig } from "../../runtime-api.js"; +import type { OpenClawConfig, PluginRuntime } from "../../runtime-api.js"; import { deliverMattermostReplyPayload } from "./reply-delivery.js"; type DeliverMattermostReplyPayloadParams = Parameters[0]; @@ -13,7 +12,7 @@ type ReplyDeliveryMarkdownTableMode = Parameters< >[1]; function createReplyDeliveryCore(): DeliverMattermostReplyPayloadParams["core"] { - return createPluginRuntimeMock({ + return { channel: { text: { chunkByNewline: vi.fn((text: string) => [text]), @@ -35,7 +34,7 @@ function createReplyDeliveryCore(): DeliverMattermostReplyPayloadParams["core"] chunkMarkdownTextWithMode: vi.fn((text: string) => [text]), }, }, - }); + } as unknown as PluginRuntime; } describe("deliverMattermostReplyPayload", () => {