feat(attachments): attach external notes, screenshots, photos, and image URLs to sparks

This commit is contained in:
airent106 committed 2026-10-29 11:55:02 -06:00
1 parent 8a25771839
commit 4c5560a5a1
6 files changed
+888 -5

No files matched your search

+34
View File
@@ -182,3 +182,37 @@ test("Head-to-Head Arena and Triage Review endpoints update arena_wins and compo
const arenaData = await arenaRes.json();
assert.equal(arenaData.winner.arena_wins, beforeWins + 1);
});
test("External notes and images can be attached to a spark and promoted to Mockup Studio", async () => {
const samplePngDataUrl =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
const attRes = await fetch(`${baseUrl}/api/ideas/1/attachments`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
title: "Vintage Ski Patch Photo",
textContent: "Found this 1978 Chamonix felt patch as color reference.",
sourceUrl: "https://example.com/chamonix-patch",
imageDataUrl: samplePngDataUrl,
appendToNotes: true,
setAsCover: true
})
});
assert.equal(attRes.status, 201);
const attData = await attRes.json();
assert.equal(attData.attachment.title, "Vintage Ski Patch Photo");
assert.equal(attData.attachment.type, "image");
assert.ok(attData.idea.notes_markdown.includes("1978 Chamonix felt patch"));
assert.ok(attData.idea.links.some((l) => l.url === "https://example.com/chamonix-patch"));
// Promote attachment to Mockup Studio
const promRes = await fetch(
`${baseUrl}/api/ideas/1/attachments/${attData.attachment.id}/promote-mockup`,
{ method: "POST" }
);
assert.equal(promRes.status, 201);
const promData = await promRes.json();
assert.equal(promData.idea.mockups[0].title, "Vintage Ski Patch Photo");
});