We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05a056c commit d34b0caCopy full SHA for d34b0ca
tests/api-method.test.ts
@@ -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