test(channels): dedupe inbound contract dispatch capture setup

This commit is contained in:
Peter Steinberger
2026-02-18 13:12:22 +00:00
parent 39881a318a
commit e1b491d961
3 changed files with 41 additions and 27 deletions

View File

@@ -0,0 +1,20 @@
import type { MsgContext } from "../../src/auto-reply/templating.js";
import { buildDispatchInboundCaptureMock } from "./dispatch-inbound-capture.js";
export type InboundContextCapture = {
ctx: MsgContext | undefined;
};
export function createInboundContextCapture(): InboundContextCapture {
return { ctx: undefined };
}
export async function buildDispatchInboundContextCapture(
importOriginal: <T extends Record<string, unknown>>() => Promise<T>,
capture: InboundContextCapture,
) {
const actual = await importOriginal<typeof import("../../src/auto-reply/dispatch.js")>();
return buildDispatchInboundCaptureMock(actual, (ctx) => {
capture.ctx = ctx as MsgContext;
});
}