feat: add POST /api/images/from-url route

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
makiolajandClaude Opus 4.6 committed 2026-04-03 13:17:10 +02:00
1 parent 0004329895
commit b3a13fa974
2 files changed
+41

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { describe, expect, test } from "bun:test";
import { Hono } from "hono";
import { imageRoutes } from "../../src/server/routes/images";
const app = new Hono();
app.route("/api/images", imageRoutes);
describe("POST /api/images/from-url", () => {
test("returns 400 for missing URL", async () => {
const res = await app.request("/api/images/from-url", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
});
expect(res.status).toBe(400);
});
test("returns 400 for invalid URL", async () => {
const res = await app.request("/api/images/from-url", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url: "not-a-url" }),
});
expect(res.status).toBe(400);
});
});