test: drop matrix contract runtime mock

This commit is contained in:
Peter Steinberger
2026-04-20 21:36:02 +01:00
parent e4a21b35f5
commit 2b6acf9c92

View File

@@ -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;