mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 08:02:04 +00:00
test(contracts): avoid sync telegram vitest harness loads
This commit is contained in:
@@ -19,9 +19,12 @@ export const { signalOutbound } = loadBundledPluginTestApiSync<{
|
||||
export const { slackOutbound } = loadBundledPluginTestApiSync<{
|
||||
slackOutbound: ChannelOutboundAdapter;
|
||||
}>("slack");
|
||||
export const { telegramOutbound } = loadBundledPluginTestApiSync<{
|
||||
export const { telegramOutbound } = loadBundledPluginPublicSurfaceSync<{
|
||||
telegramOutbound: ChannelOutboundAdapter;
|
||||
}>("telegram");
|
||||
}>({
|
||||
pluginId: "telegram",
|
||||
artifactBasename: "src/outbound-adapter.js",
|
||||
});
|
||||
export const { whatsappOutbound } = loadBundledPluginTestApiSync<{
|
||||
whatsappOutbound: ChannelOutboundAdapter;
|
||||
}>("whatsapp");
|
||||
|
||||
@@ -36,12 +36,24 @@ const { createInboundSlackTestContext, prepareSlackMessage } = loadBundledPlugin
|
||||
opts: { source: string };
|
||||
}) => Promise<SlackPrepareResult>;
|
||||
}>("slack");
|
||||
const { buildTelegramMessageContextForTest } = loadBundledPluginTestApiSync<{
|
||||
buildTelegramMessageContextForTest: (params: {
|
||||
cfg: OpenClawConfig;
|
||||
message: Record<string, unknown>;
|
||||
}) => Promise<{ ctxPayload: MsgContext } | null | undefined>;
|
||||
}>("telegram");
|
||||
const telegramHarnessModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
pluginId: "telegram",
|
||||
artifactBasename: "src/bot-message-context.test-harness.js",
|
||||
});
|
||||
|
||||
async function buildTelegramMessageContextForTest(params: {
|
||||
cfg: OpenClawConfig;
|
||||
message: Record<string, unknown>;
|
||||
}): Promise<{ ctxPayload: MsgContext } | null | undefined> {
|
||||
const telegramHarnessModule = (await import(telegramHarnessModuleId)) as {
|
||||
buildTelegramMessageContextForTest: (params: {
|
||||
cfg: OpenClawConfig;
|
||||
message: Record<string, unknown>;
|
||||
}) => Promise<{ ctxPayload: MsgContext } | null | undefined>;
|
||||
};
|
||||
return await telegramHarnessModule.buildTelegramMessageContextForTest(params);
|
||||
}
|
||||
|
||||
const signalApiModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
|
||||
Reference in New Issue
Block a user