mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 22:32:12 +00:00
test(mattermost): slim leaf runtime fixtures
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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<typeof deliverMattermostReplyPayload>[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", () => {
|
||||
|
||||
Reference in New Issue
Block a user