Test Pi tool wrapper for send
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user