import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { clientChatInputSchema } from "../../src/modules/agent/messages"; describe("clientChatInputSchema", () => { it("accepts messages with image attachments", () => { const parsed = clientChatInputSchema.safeParse({ stream: true, messages: [ { role: "user", content: "Add this appointment to the calendar", attachments: [{ type: "image", url: "/api/uploads/assistant/house-1/photo.jpg" }], }, ], }); assert.equal(parsed.success, true); }); it("rejects empty message content", () => { const parsed = clientChatInputSchema.safeParse({ messages: [{ role: "user", content: " " }], }); assert.equal(parsed.success, false); }); it("accepts an optional model ID", () => { const parsed = clientChatInputSchema.safeParse({ model: "qwen2.5-coder", messages: [{ role: "user", content: "hello" }], }); assert.equal(parsed.success, true); }); it("rejects invalid model IDs", () => { const parsed = clientChatInputSchema.safeParse({ model: "bad model", messages: [{ role: "user", content: "hello" }], }); assert.equal(parsed.success, false); }); it("rejects whitespace-padded model IDs", () => { const parsed = clientChatInputSchema.safeParse({ model: " qwen2.5-coder ", messages: [{ role: "user", content: "hello" }], }); assert.equal(parsed.success, false); }); });