mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:42:44 +00:00
refactor(tests): dedupe gateway send and threading fixtures
This commit is contained in:
@@ -46,6 +46,19 @@ const makeContext = (): GatewayRequestContext =>
|
|||||||
dedupe: new Map(),
|
dedupe: new Map(),
|
||||||
}) as unknown as GatewayRequestContext;
|
}) as unknown as GatewayRequestContext;
|
||||||
|
|
||||||
|
async function runSend(params: Record<string, unknown>) {
|
||||||
|
const respond = vi.fn();
|
||||||
|
await sendHandlers.send({
|
||||||
|
params: params as never,
|
||||||
|
respond,
|
||||||
|
context: makeContext(),
|
||||||
|
req: { type: "req", id: "1", method: "send" },
|
||||||
|
client: null,
|
||||||
|
isWebchatConnect: () => false,
|
||||||
|
});
|
||||||
|
return { respond };
|
||||||
|
}
|
||||||
|
|
||||||
describe("gateway send mirroring", () => {
|
describe("gateway send mirroring", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
@@ -54,19 +67,11 @@ describe("gateway send mirroring", () => {
|
|||||||
it("accepts media-only sends without message", async () => {
|
it("accepts media-only sends without message", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m-media", channel: "slack" }]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m-media", channel: "slack" }]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
const { respond } = await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
mediaUrl: "https://example.com/a.png",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
mediaUrl: "https://example.com/a.png",
|
idempotencyKey: "idem-media-only",
|
||||||
channel: "slack",
|
|
||||||
idempotencyKey: "idem-media-only",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||||
@@ -83,19 +88,11 @@ describe("gateway send mirroring", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("rejects empty sends when neither text nor media is present", async () => {
|
it("rejects empty sends when neither text nor media is present", async () => {
|
||||||
const respond = vi.fn();
|
const { respond } = await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: " ",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
message: " ",
|
idempotencyKey: "idem-empty",
|
||||||
channel: "slack",
|
|
||||||
idempotencyKey: "idem-empty",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).not.toHaveBeenCalled();
|
expect(mocks.deliverOutboundPayloads).not.toHaveBeenCalled();
|
||||||
@@ -109,19 +106,11 @@ describe("gateway send mirroring", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns actionable guidance when channel is internal webchat", async () => {
|
it("returns actionable guidance when channel is internal webchat", async () => {
|
||||||
const respond = vi.fn();
|
const { respond } = await runSend({
|
||||||
await sendHandlers.send({
|
to: "x",
|
||||||
params: {
|
message: "hi",
|
||||||
to: "x",
|
channel: "webchat",
|
||||||
message: "hi",
|
idempotencyKey: "idem-webchat",
|
||||||
channel: "webchat",
|
|
||||||
idempotencyKey: "idem-webchat",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).not.toHaveBeenCalled();
|
expect(mocks.deliverOutboundPayloads).not.toHaveBeenCalled();
|
||||||
@@ -144,20 +133,12 @@ describe("gateway send mirroring", () => {
|
|||||||
it("does not mirror when delivery returns no results", async () => {
|
it("does not mirror when delivery returns no results", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: "hi",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
message: "hi",
|
idempotencyKey: "idem-1",
|
||||||
channel: "slack",
|
sessionKey: "agent:main:main",
|
||||||
idempotencyKey: "idem-1",
|
|
||||||
sessionKey: "agent:main:main",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||||
@@ -172,21 +153,13 @@ describe("gateway send mirroring", () => {
|
|||||||
it("mirrors media filenames when delivery succeeds", async () => {
|
it("mirrors media filenames when delivery succeeds", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m1", channel: "slack" }]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m1", channel: "slack" }]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: "caption",
|
||||||
to: "channel:C1",
|
mediaUrl: "https://example.com/files/report.pdf?sig=1",
|
||||||
message: "caption",
|
channel: "slack",
|
||||||
mediaUrl: "https://example.com/files/report.pdf?sig=1",
|
idempotencyKey: "idem-2",
|
||||||
channel: "slack",
|
sessionKey: "agent:main:main",
|
||||||
idempotencyKey: "idem-2",
|
|
||||||
sessionKey: "agent:main:main",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||||
@@ -203,20 +176,12 @@ describe("gateway send mirroring", () => {
|
|||||||
it("mirrors MEDIA tags as attachments", async () => {
|
it("mirrors MEDIA tags as attachments", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m2", channel: "slack" }]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m2", channel: "slack" }]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: "Here\nMEDIA:https://example.com/image.png",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
message: "Here\nMEDIA:https://example.com/image.png",
|
idempotencyKey: "idem-3",
|
||||||
channel: "slack",
|
sessionKey: "agent:main:main",
|
||||||
idempotencyKey: "idem-3",
|
|
||||||
sessionKey: "agent:main:main",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||||
@@ -233,20 +198,12 @@ describe("gateway send mirroring", () => {
|
|||||||
it("lowercases provided session keys for mirroring", async () => {
|
it("lowercases provided session keys for mirroring", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m-lower", channel: "slack" }]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m-lower", channel: "slack" }]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: "hi",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
message: "hi",
|
idempotencyKey: "idem-lower",
|
||||||
channel: "slack",
|
sessionKey: "agent:main:slack:channel:C123",
|
||||||
idempotencyKey: "idem-lower",
|
|
||||||
sessionKey: "agent:main:slack:channel:C123",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
expect(mocks.deliverOutboundPayloads).toHaveBeenCalledWith(
|
||||||
@@ -261,19 +218,11 @@ describe("gateway send mirroring", () => {
|
|||||||
it("derives a target session key when none is provided", async () => {
|
it("derives a target session key when none is provided", async () => {
|
||||||
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m3", channel: "slack" }]);
|
mocks.deliverOutboundPayloads.mockResolvedValue([{ messageId: "m3", channel: "slack" }]);
|
||||||
|
|
||||||
const respond = vi.fn();
|
await runSend({
|
||||||
await sendHandlers.send({
|
to: "channel:C1",
|
||||||
params: {
|
message: "hello",
|
||||||
to: "channel:C1",
|
channel: "slack",
|
||||||
message: "hello",
|
idempotencyKey: "idem-4",
|
||||||
channel: "slack",
|
|
||||||
idempotencyKey: "idem-4",
|
|
||||||
},
|
|
||||||
respond,
|
|
||||||
context: makeContext(),
|
|
||||||
req: { type: "req", id: "1", method: "send" },
|
|
||||||
client: null,
|
|
||||||
isWebchatConnect: () => false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mocks.recordSessionMetaFromInbound).toHaveBeenCalled();
|
expect(mocks.recordSessionMetaFromInbound).toHaveBeenCalled();
|
||||||
|
|||||||
@@ -49,6 +49,37 @@ const telegramConfig = {
|
|||||||
},
|
},
|
||||||
} as OpenClawConfig;
|
} as OpenClawConfig;
|
||||||
|
|
||||||
|
async function runThreadingAction(params: {
|
||||||
|
cfg: OpenClawConfig;
|
||||||
|
actionParams: Record<string, unknown>;
|
||||||
|
toolContext?: Record<string, unknown>;
|
||||||
|
}) {
|
||||||
|
await runMessageAction({
|
||||||
|
cfg: params.cfg,
|
||||||
|
action: "send",
|
||||||
|
params: params.actionParams as never,
|
||||||
|
toolContext: params.toolContext as never,
|
||||||
|
agentId: "main",
|
||||||
|
});
|
||||||
|
return mocks.executeSendAction.mock.calls[0]?.[0] as {
|
||||||
|
threadId?: string;
|
||||||
|
replyToId?: string;
|
||||||
|
ctx?: { agentId?: string; mirror?: { sessionKey?: string }; params?: Record<string, unknown> };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function mockHandledSendAction() {
|
||||||
|
mocks.executeSendAction.mockResolvedValue({
|
||||||
|
handledBy: "plugin",
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultTelegramToolContext = {
|
||||||
|
currentChannelId: "telegram:123",
|
||||||
|
currentThreadTs: "42",
|
||||||
|
} as const;
|
||||||
|
|
||||||
describe("runMessageAction threading auto-injection", () => {
|
describe("runMessageAction threading auto-injection", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const { createPluginRuntime } = await import("../../plugins/runtime/index.js");
|
const { createPluginRuntime } = await import("../../plugins/runtime/index.js");
|
||||||
@@ -80,15 +111,11 @@ describe("runMessageAction threading auto-injection", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("uses toolContext thread when auto-threading is active", async () => {
|
it("uses toolContext thread when auto-threading is active", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: slackConfig,
|
cfg: slackConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "slack",
|
channel: "slack",
|
||||||
target: "channel:C123",
|
target: "channel:C123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
@@ -98,24 +125,18 @@ describe("runMessageAction threading auto-injection", () => {
|
|||||||
currentThreadTs: "111.222",
|
currentThreadTs: "111.222",
|
||||||
replyToMode: "all",
|
replyToMode: "all",
|
||||||
},
|
},
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0];
|
|
||||||
expect(call?.ctx?.agentId).toBe("main");
|
expect(call?.ctx?.agentId).toBe("main");
|
||||||
expect(call?.ctx?.mirror?.sessionKey).toBe("agent:main:slack:channel:c123:thread:111.222");
|
expect(call?.ctx?.mirror?.sessionKey).toBe("agent:main:slack:channel:c123:thread:111.222");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("matches auto-threading when channel ids differ in case", async () => {
|
it("matches auto-threading when channel ids differ in case", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: slackConfig,
|
cfg: slackConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "slack",
|
channel: "slack",
|
||||||
target: "channel:c123",
|
target: "channel:c123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
@@ -125,152 +146,92 @@ describe("runMessageAction threading auto-injection", () => {
|
|||||||
currentThreadTs: "333.444",
|
currentThreadTs: "333.444",
|
||||||
replyToMode: "all",
|
replyToMode: "all",
|
||||||
},
|
},
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0];
|
|
||||||
expect(call?.ctx?.mirror?.sessionKey).toBe("agent:main:slack:channel:c123:thread:333.444");
|
expect(call?.ctx?.mirror?.sessionKey).toBe("agent:main:slack:channel:c123:thread:333.444");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("auto-injects telegram threadId from toolContext when omitted", async () => {
|
it("auto-injects telegram threadId from toolContext when omitted", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: telegramConfig,
|
cfg: telegramConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
target: "telegram:123",
|
target: "telegram:123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
},
|
},
|
||||||
toolContext: {
|
toolContext: defaultTelegramToolContext,
|
||||||
currentChannelId: "telegram:123",
|
|
||||||
currentThreadTs: "42",
|
|
||||||
},
|
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
|
|
||||||
threadId?: string;
|
|
||||||
ctx?: { params?: Record<string, unknown> };
|
|
||||||
};
|
|
||||||
expect(call?.threadId).toBe("42");
|
expect(call?.threadId).toBe("42");
|
||||||
expect(call?.ctx?.params?.threadId).toBe("42");
|
expect(call?.ctx?.params?.threadId).toBe("42");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips telegram auto-threading when target chat differs", async () => {
|
it("skips telegram auto-threading when target chat differs", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: telegramConfig,
|
cfg: telegramConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
target: "telegram:999",
|
target: "telegram:999",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
},
|
},
|
||||||
toolContext: {
|
toolContext: defaultTelegramToolContext,
|
||||||
currentChannelId: "telegram:123",
|
|
||||||
currentThreadTs: "42",
|
|
||||||
},
|
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
|
|
||||||
ctx?: { params?: Record<string, unknown> };
|
|
||||||
};
|
|
||||||
expect(call?.ctx?.params?.threadId).toBeUndefined();
|
expect(call?.ctx?.params?.threadId).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("matches telegram target with internal prefix variations", async () => {
|
it("matches telegram target with internal prefix variations", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: telegramConfig,
|
cfg: telegramConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
target: "telegram:group:123",
|
target: "telegram:group:123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
},
|
},
|
||||||
toolContext: {
|
toolContext: defaultTelegramToolContext,
|
||||||
currentChannelId: "telegram:123",
|
|
||||||
currentThreadTs: "42",
|
|
||||||
},
|
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
|
|
||||||
ctx?: { params?: Record<string, unknown> };
|
|
||||||
};
|
|
||||||
expect(call?.ctx?.params?.threadId).toBe("42");
|
expect(call?.ctx?.params?.threadId).toBe("42");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses explicit telegram threadId when provided", async () => {
|
it("uses explicit telegram threadId when provided", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: telegramConfig,
|
cfg: telegramConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
target: "telegram:123",
|
target: "telegram:123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
threadId: "999",
|
threadId: "999",
|
||||||
},
|
},
|
||||||
toolContext: {
|
toolContext: defaultTelegramToolContext,
|
||||||
currentChannelId: "telegram:123",
|
|
||||||
currentThreadTs: "42",
|
|
||||||
},
|
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
|
|
||||||
threadId?: string;
|
|
||||||
ctx?: { params?: Record<string, unknown> };
|
|
||||||
};
|
|
||||||
expect(call?.threadId).toBe("999");
|
expect(call?.threadId).toBe("999");
|
||||||
expect(call?.ctx?.params?.threadId).toBe("999");
|
expect(call?.ctx?.params?.threadId).toBe("999");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("threads explicit replyTo through executeSendAction", async () => {
|
it("threads explicit replyTo through executeSendAction", async () => {
|
||||||
mocks.executeSendAction.mockResolvedValue({
|
mockHandledSendAction();
|
||||||
handledBy: "plugin",
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMessageAction({
|
const call = await runThreadingAction({
|
||||||
cfg: telegramConfig,
|
cfg: telegramConfig,
|
||||||
action: "send",
|
actionParams: {
|
||||||
params: {
|
|
||||||
channel: "telegram",
|
channel: "telegram",
|
||||||
target: "telegram:123",
|
target: "telegram:123",
|
||||||
message: "hi",
|
message: "hi",
|
||||||
replyTo: "777",
|
replyTo: "777",
|
||||||
},
|
},
|
||||||
toolContext: {
|
toolContext: defaultTelegramToolContext,
|
||||||
currentChannelId: "telegram:123",
|
|
||||||
currentThreadTs: "42",
|
|
||||||
},
|
|
||||||
agentId: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
|
|
||||||
replyToId?: string;
|
|
||||||
ctx?: { params?: Record<string, unknown> };
|
|
||||||
};
|
|
||||||
expect(call?.replyToId).toBe("777");
|
expect(call?.replyToId).toBe("777");
|
||||||
expect(call?.ctx?.params?.replyTo).toBe("777");
|
expect(call?.ctx?.params?.replyTo).toBe("777");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user