mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:00:54 +00:00
test: drop matrix contract runtime mock
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { vi } from "vitest";
|
||||
import {
|
||||
listBundledChannelPlugins,
|
||||
setBundledChannelRuntime,
|
||||
@@ -12,10 +11,6 @@ import {
|
||||
} from "../../../src/plugin-sdk/line.js";
|
||||
import { channelPluginSurfaceKeys, type ChannelPluginSurface } from "./manifest.js";
|
||||
|
||||
function buildBundledPluginModuleId(pluginId: string, artifactBasename: string): string {
|
||||
return ["..", "..", "..", "extensions", pluginId, artifactBasename].join("/");
|
||||
}
|
||||
|
||||
type SurfaceContractEntry = {
|
||||
id: string;
|
||||
plugin: Pick<
|
||||
@@ -46,13 +41,6 @@ type DirectoryContractEntry = {
|
||||
accountId?: string;
|
||||
};
|
||||
|
||||
const sendMessageMatrixMock = vi.hoisted(() =>
|
||||
vi.fn(async (to: string, _message: string, opts?: { threadId?: string }) => ({
|
||||
messageId: opts?.threadId ? "$matrix-thread" : "$matrix-root",
|
||||
roomId: to.replace(/^room:/, ""),
|
||||
})),
|
||||
);
|
||||
|
||||
setBundledChannelRuntime("line", {
|
||||
channel: {
|
||||
line: {
|
||||
@@ -64,15 +52,6 @@ setBundledChannelRuntime("line", {
|
||||
},
|
||||
} as never);
|
||||
|
||||
vi.mock(buildBundledPluginModuleId("matrix", "runtime-api.js"), async () => {
|
||||
const matrixRuntimeApiModuleId = buildBundledPluginModuleId("matrix", "runtime-api.js");
|
||||
const actual = await vi.importActual(matrixRuntimeApiModuleId);
|
||||
return {
|
||||
...actual,
|
||||
sendMessageMatrix: sendMessageMatrixMock,
|
||||
};
|
||||
});
|
||||
|
||||
let surfaceContractRegistryCache: SurfaceContractEntry[] | undefined;
|
||||
let threadingContractRegistryCache: ThreadingContractEntry[] | undefined;
|
||||
let directoryContractRegistryCache: DirectoryContractEntry[] | undefined;
|
||||
|
||||
Reference in New Issue
Block a user