mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 09:20:24 +00:00
test(runtime): fix stale harness and registry mocks
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-contract";
|
||||
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import {
|
||||
loadBundledPluginTestApiSync,
|
||||
primeChannelOutboundSendMock,
|
||||
} from "openclaw/plugin-sdk/testing";
|
||||
import { primeChannelOutboundSendMock } from "openclaw/plugin-sdk/testing";
|
||||
import { vi, type Mock } from "vitest";
|
||||
import { slackOutbound } from "./outbound-adapter.js";
|
||||
|
||||
type OutboundSendMock = Mock<(...args: unknown[]) => Promise<Record<string, unknown>>>;
|
||||
|
||||
@@ -14,17 +11,6 @@ type SlackOutboundPayloadHarness = {
|
||||
to: string;
|
||||
};
|
||||
|
||||
let slackOutboundCache: ChannelOutboundAdapter | undefined;
|
||||
|
||||
function getSlackOutbound(): ChannelOutboundAdapter {
|
||||
if (!slackOutboundCache) {
|
||||
({ slackOutbound: slackOutboundCache } = loadBundledPluginTestApiSync<{
|
||||
slackOutbound: ChannelOutboundAdapter;
|
||||
}>("slack"));
|
||||
}
|
||||
return slackOutboundCache;
|
||||
}
|
||||
|
||||
export function createSlackOutboundPayloadHarness(params: {
|
||||
payload: ReplyPayload;
|
||||
sendResults?: Array<{ messageId: string }>;
|
||||
@@ -45,7 +31,7 @@ export function createSlackOutboundPayloadHarness(params: {
|
||||
},
|
||||
};
|
||||
return {
|
||||
run: async () => await getSlackOutbound().sendPayload!(ctx),
|
||||
run: async () => await slackOutbound.sendPayload!(ctx),
|
||||
sendMock: sendSlack,
|
||||
to: ctx.to,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user