mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
test(inbound): share dispatch capture mock across channels
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildDispatchInboundContextCapture } from "../../../test/helpers/inbound-contract-capture.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { inboundCtxCapture as capture } from "../../../test/helpers/inbound-contract-dispatch-mock.js";
|
||||
import { expectInboundContextContract } from "../../../test/helpers/inbound-contract.js";
|
||||
import type { MsgContext } from "../../auto-reply/templating.js";
|
||||
|
||||
const capture = vi.hoisted(() => ({ ctx: undefined as MsgContext | undefined }));
|
||||
|
||||
vi.mock("../../auto-reply/dispatch.js", async (importOriginal) => {
|
||||
return await buildDispatchInboundContextCapture(importOriginal, capture);
|
||||
});
|
||||
|
||||
import type { DiscordMessagePreflightContext } from "./message-handler.preflight.js";
|
||||
import { processDiscordMessage } from "./message-handler.process.js";
|
||||
import { createBaseDiscordMessageContext } from "./message-handler.test-harness.js";
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildDispatchInboundContextCapture } from "../../../test/helpers/inbound-contract-capture.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { inboundCtxCapture as capture } from "../../../test/helpers/inbound-contract-dispatch-mock.js";
|
||||
import { expectInboundContextContract } from "../../../test/helpers/inbound-contract.js";
|
||||
import type { MsgContext } from "../../auto-reply/templating.js";
|
||||
|
||||
const capture = vi.hoisted(() => ({ ctx: undefined as MsgContext | undefined }));
|
||||
|
||||
vi.mock("../../auto-reply/dispatch.js", async (importOriginal) => {
|
||||
return await buildDispatchInboundContextCapture(importOriginal, capture);
|
||||
});
|
||||
|
||||
import { createSignalEventHandler } from "./event-handler.js";
|
||||
import {
|
||||
createBaseSignalEventHandlerDeps,
|
||||
|
||||
9
test/helpers/inbound-contract-dispatch-mock.ts
Normal file
9
test/helpers/inbound-contract-dispatch-mock.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { vi } from "vitest";
|
||||
import { createInboundContextCapture } from "./inbound-contract-capture.js";
|
||||
import { buildDispatchInboundContextCapture } from "./inbound-contract-capture.js";
|
||||
|
||||
export const inboundCtxCapture = createInboundContextCapture();
|
||||
|
||||
vi.mock("../../src/auto-reply/dispatch.js", async (importOriginal) => {
|
||||
return await buildDispatchInboundContextCapture(importOriginal, inboundCtxCapture);
|
||||
});
|
||||
Reference in New Issue
Block a user