mirror of https://github.com/openclaw/openclaw.git
test: trim message action poll runner setup
This commit is contained in:
parent
0875c2e370
commit
768ec2a712
|
|
@ -3,12 +3,21 @@ import type { ChannelPlugin } from "../../channels/plugins/types.js";
|
|||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { setActivePluginRegistry } from "../../plugins/runtime.js";
|
||||
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
|
||||
|
||||
let runMessageAction: typeof import("./message-action-runner.js").runMessageAction;
|
||||
import { runMessageAction } from "./message-action-runner.js";
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
executePollAction: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./outbound-send-service.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("./outbound-send-service.js")>(
|
||||
"./outbound-send-service.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
executePollAction: mocks.executePollAction,
|
||||
};
|
||||
});
|
||||
const telegramConfig = {
|
||||
channels: {
|
||||
telegram: {
|
||||
|
|
@ -92,17 +101,7 @@ async function runPollAction(params: {
|
|||
}
|
||||
|
||||
describe("runMessageAction poll handling", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("./outbound-send-service.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("./outbound-send-service.js")>(
|
||||
"./outbound-send-service.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
executePollAction: mocks.executePollAction,
|
||||
};
|
||||
});
|
||||
beforeEach(() => {
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
|
|
@ -118,7 +117,6 @@ describe("runMessageAction poll handling", () => {
|
|||
payload: { ok: true, corePoll: input.resolveCorePoll() },
|
||||
pollResult: { ok: true },
|
||||
}));
|
||||
({ runMessageAction } = await import("./message-action-runner.js"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue