mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:44:33 +00:00
fix: unify inbound dispatch pipeline
This commit is contained in:
@@ -5,17 +5,24 @@ import { expectInboundContextContract } from "../../../test/helpers/inbound-cont
|
||||
|
||||
let capturedCtx: MsgContext | undefined;
|
||||
|
||||
vi.mock("../../auto-reply/reply/dispatch-from-config.js", () => ({
|
||||
dispatchReplyFromConfig: vi.fn(async (params: { ctx: MsgContext }) => {
|
||||
vi.mock("../../auto-reply/dispatch.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../../auto-reply/dispatch.js")>();
|
||||
const dispatchInboundMessage = vi.fn(async (params: { ctx: MsgContext }) => {
|
||||
capturedCtx = params.ctx;
|
||||
return { queuedFinal: false, counts: { tool: 0, block: 0 } };
|
||||
}),
|
||||
}));
|
||||
return { queuedFinal: false, counts: { tool: 0, block: 0, final: 0 } };
|
||||
});
|
||||
return {
|
||||
...actual,
|
||||
dispatchInboundMessage,
|
||||
dispatchInboundMessageWithDispatcher: dispatchInboundMessage,
|
||||
dispatchInboundMessageWithBufferedDispatcher: dispatchInboundMessage,
|
||||
};
|
||||
});
|
||||
|
||||
import { createSignalEventHandler } from "./event-handler.js";
|
||||
|
||||
describe("signal createSignalEventHandler inbound contract", () => {
|
||||
it("passes a finalized MsgContext to dispatchReplyFromConfig", async () => {
|
||||
it("passes a finalized MsgContext to dispatchInboundMessage", async () => {
|
||||
capturedCtx = undefined;
|
||||
|
||||
const handler = createSignalEventHandler({
|
||||
|
||||
Reference in New Issue
Block a user