mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:07:41 +00:00
refactor(web-test): share mock listener harness
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import {
|
||||
createMockWebListener,
|
||||
installWebAutoReplyTestHomeHooks,
|
||||
installWebAutoReplyUnitTestHooks,
|
||||
resetLoadConfigMock,
|
||||
@@ -11,18 +12,6 @@ import {
|
||||
|
||||
installWebAutoReplyTestHomeHooks();
|
||||
|
||||
function createMockListener() {
|
||||
return {
|
||||
close: vi.fn(async () => undefined),
|
||||
onClose: new Promise<import("./inbound.js").WebListenerCloseReason>(() => {}),
|
||||
signalClose: vi.fn(),
|
||||
sendMessage: vi.fn(async () => ({ messageId: "msg-1" })),
|
||||
sendPoll: vi.fn(async () => ({ messageId: "poll-1" })),
|
||||
sendReaction: vi.fn(async () => undefined),
|
||||
sendComposingTo: vi.fn(async () => undefined),
|
||||
};
|
||||
}
|
||||
|
||||
describe("typing controller idle", () => {
|
||||
installWebAutoReplyUnitTestHooks();
|
||||
|
||||
@@ -70,7 +59,7 @@ describe("typing controller idle", () => {
|
||||
reply,
|
||||
sendMedia,
|
||||
});
|
||||
return createMockListener();
|
||||
return createMockWebListener();
|
||||
},
|
||||
false,
|
||||
replyResolver,
|
||||
|
||||
Reference in New Issue
Block a user