composerAttachmentSource.test.ts 724 B

12345678910111213141516171819
  1. import { expect, it, vi } from "vitest";
  2. import { uploadComposerAttachment } from "@/v4/composer/attachmentUpload.js";
  3. it.each([true, false])(
  4. "preserves deferred text material metadata across local/remote upload (local=%s)",
  5. async (local) => {
  6. const put = vi.fn(async () => ({ ref: "zcode-artifact://history" }));
  7. const ref = await uploadComposerAttachment(put, "task", {
  8. kind: "file",
  9. filename: "history.txt",
  10. mimeType: "text/plain",
  11. sizeBytes: 3,
  12. sourceKind: "topic-history",
  13. messageCount: 2,
  14. ...(local ? { localPath: "/target/history.txt" } : { textContent: "abc" }),
  15. });
  16. expect(ref).toMatchObject({ sourceKind: "topic-history", messageCount: 2 });
  17. },
  18. );