mirror of https://github.com/openclaw/openclaw.git
test: preload inbound contract fixtures
This commit is contained in:
parent
2f9e2f500f
commit
5f0c466146
|
|
@ -62,6 +62,18 @@ vi.mock("../../../../extensions/whatsapp/src/auto-reply/deliver-reply.js", () =>
|
|||
deliverWebReply: vi.fn(async () => {}),
|
||||
}));
|
||||
|
||||
const { processDiscordMessage } =
|
||||
await import("../../../../extensions/discord/src/monitor/message-handler.process.js");
|
||||
const { createBaseDiscordMessageContext, createDiscordDirectMessageContextOverrides } =
|
||||
await import("../../../../extensions/discord/src/monitor/message-handler.test-harness.js");
|
||||
const { finalizeInboundContext } = await import("../../../auto-reply/reply/inbound-context.js");
|
||||
const { prepareSlackMessage } =
|
||||
await import("../../../../extensions/slack/src/monitor/message-handler/prepare.js");
|
||||
const { createInboundSlackTestContext } =
|
||||
await import("../../../../extensions/slack/src/monitor/message-handler/prepare.test-helpers.js");
|
||||
const { buildTelegramMessageContextForTest } =
|
||||
await import("../../../../extensions/telegram/src/bot-message-context.test-harness.js");
|
||||
|
||||
function createSlackAccount(config: ResolvedSlackAccount["config"] = {}): ResolvedSlackAccount {
|
||||
return {
|
||||
accountId: "default",
|
||||
|
|
@ -94,10 +106,6 @@ describe("channel inbound contract", () => {
|
|||
});
|
||||
|
||||
it("keeps Discord inbound context finalized", async () => {
|
||||
const { processDiscordMessage } =
|
||||
await import("../../../../extensions/discord/src/monitor/message-handler.process.js");
|
||||
const { createBaseDiscordMessageContext, createDiscordDirectMessageContextOverrides } =
|
||||
await import("../../../../extensions/discord/src/monitor/message-handler.test-harness.js");
|
||||
const messageCtx = await createBaseDiscordMessageContext({
|
||||
cfg: { messages: {} },
|
||||
ackReactionScope: "direct",
|
||||
|
|
@ -111,7 +119,6 @@ describe("channel inbound contract", () => {
|
|||
});
|
||||
|
||||
it("keeps Signal inbound context finalized", async () => {
|
||||
const { finalizeInboundContext } = await import("../../../auto-reply/reply/inbound-context.js");
|
||||
const ctx = finalizeInboundContext({
|
||||
Body: "Alice: hi",
|
||||
BodyForAgent: "hi",
|
||||
|
|
@ -139,10 +146,6 @@ describe("channel inbound contract", () => {
|
|||
});
|
||||
|
||||
it("keeps Slack inbound context finalized", async () => {
|
||||
const { prepareSlackMessage } =
|
||||
await import("../../../../extensions/slack/src/monitor/message-handler/prepare.js");
|
||||
const { createInboundSlackTestContext } =
|
||||
await import("../../../../extensions/slack/src/monitor/message-handler/prepare.test-helpers.js");
|
||||
const ctx = createInboundSlackTestContext({
|
||||
cfg: {
|
||||
channels: { slack: { enabled: true } },
|
||||
|
|
@ -163,9 +166,6 @@ describe("channel inbound contract", () => {
|
|||
});
|
||||
|
||||
it("keeps Telegram inbound context finalized", async () => {
|
||||
const { buildTelegramMessageContextForTest } =
|
||||
await import("../../../../extensions/telegram/src/bot-message-context.test-harness.js");
|
||||
|
||||
const context = await buildTelegramMessageContextForTest({
|
||||
cfg: {
|
||||
agents: {
|
||||
|
|
@ -200,7 +200,6 @@ describe("channel inbound contract", () => {
|
|||
});
|
||||
|
||||
it("keeps WhatsApp inbound context finalized", async () => {
|
||||
const { finalizeInboundContext } = await import("../../../auto-reply/reply/inbound-context.js");
|
||||
const ctx = finalizeInboundContext({
|
||||
Body: "Alice: hi",
|
||||
BodyForAgent: "hi",
|
||||
|
|
|
|||
Loading…
Reference in New Issue