Test Pi tool wrapper for send

This commit is contained in:
EugeneTes
2026-09-08 12:23:43 +00:00
parent 202cb001e7
commit f687c1b9a3

View File

@@ -99,4 +99,13 @@ describe("send tool", () => {
await expect(handleSend({ path: "big.bin" }, opts)).rejects.toThrow(/document too large: 51\.0 MB > 50 MB/);
expect(bot.sendDocument).not.toHaveBeenCalled();
});
it("exposes a Pi tool that returns text content", async () => {
await writeFile(path.join(dir, "hello.png"), Buffer.from("fake-png"));
const tool = createSendTool(opts);
expect(tool.name).toBe("send");
const result = await tool.execute("call-1", { path: "hello.png" }, undefined, undefined, undefined as never);
expect(result.content).toEqual([{ type: "text", text: "Sent hello.png as photo." }]);
expect(bot.sendPhoto).toHaveBeenCalledTimes(1);
});
});