evOo-local/packages/contracts/src/attachments.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

32 lines
1.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { MessageBlock, validateThreadsSendInput } from "./index.js";
describe("attachment contracts", () => {
it("parses image and file message blocks", () => {
expect(
MessageBlock.parse({
kind: "image",
artifactId: "art_1",
mimeType: "image/png",
name: "shot.png",
}),
).toMatchObject({ kind: "image", name: "shot.png" });
expect(
MessageBlock.parse({
kind: "file",
artifactId: "art_2",
mimeType: "application/pdf",
name: "brief.pdf",
size: 1234,
}),
).toMatchObject({ kind: "file", size: 1234 });
});
it("requires text or attachments for threads.send", () => {
expect(validateThreadsSendInput({ text: "hello" })).toBe(true);
expect(validateThreadsSendInput({ artifactIds: ["art_1"] })).toBe(true);
expect(validateThreadsSendInput({})).toBe(false);
expect(validateThreadsSendInput({ artifactIds: ["a", "b", "c", "d", "e"] })).toBe(true);
});
});