Skip to content

Commit d34b0ca

Browse files
alexandre-mrtclaude
andcommitted
test: add HTTP method validation (146)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 05a056c commit d34b0ca

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/api-method.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { describe, expect, test } from "bun:test";
2+
import { Hono } from "hono";
3+
4+
process.env.DATABASE_URL = ":memory:";
5+
const { dropRouter } = await import("../src/routes/drop");
6+
const app = new Hono();
7+
app.route("/api", dropRouter);
8+
9+
describe("HTTP methods", () => {
10+
test("stats only responds to GET", async () => {
11+
expect((await app.request("/api/stats")).status).toBe(200);
12+
expect((await app.request("/api/stats", { method: "POST" })).status).toBe(404);
13+
});
14+
15+
test("upload only responds to POST", async () => {
16+
expect((await app.request("/api/upload")).status).toBe(404);
17+
});
18+
});

0 commit comments

Comments
 (0)