chore: rename tests FreshApp -> App (#3087)

This commit is contained in:
Marvin Hagemeister
2025-07-10 10:24:39 +02:00
committed by GitHub
parent a941dd33c5
commit e2699923b0
+27 -27
View File
@@ -3,7 +3,7 @@ import { App, getIslandRegistry, setBuildCache } from "./app.ts";
import { FakeServer } from "./test_utils.ts";
import { ProdBuildCache } from "./build_cache.ts";
Deno.test("FreshApp - .use()", async () => {
Deno.test("App - .use()", async () => {
const app = new App<{ text: string }>()
.use((ctx) => {
ctx.state.text = "A";
@@ -21,7 +21,7 @@ Deno.test("FreshApp - .use()", async () => {
expect(await res.text()).toEqual("AB");
});
Deno.test("FreshApp - .use() #2", async () => {
Deno.test("App - .use() #2", async () => {
const app = new App<{ text: string }>()
.use(() => new Response("ok #1"))
.get("/foo/bar", () => new Response("ok #2"))
@@ -33,7 +33,7 @@ Deno.test("FreshApp - .use() #2", async () => {
expect(await res.text()).toEqual("ok #1");
});
Deno.test("FreshApp - .get()", async () => {
Deno.test("App - .get()", async () => {
const app = new App()
.post("/", () => new Response("ok"))
.post("/foo", () => new Response("ok"))
@@ -49,7 +49,7 @@ Deno.test("FreshApp - .get()", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - .get() with basePath", async () => {
Deno.test("App - .get() with basePath", async () => {
const app = new App({ basePath: "/foo/bar" })
.get("/", () => new Response("ok"))
.get("/foo", () => new Response("ok"));
@@ -67,7 +67,7 @@ Deno.test("FreshApp - .get() with basePath", async () => {
expect(res.status).toEqual(200);
});
Deno.test("FreshApp - .post()", async () => {
Deno.test("App - .post()", async () => {
const app = new App<{ text: string }>()
.get("/", () => new Response("fail"))
.get("/foo", () => new Response("fail"))
@@ -83,7 +83,7 @@ Deno.test("FreshApp - .post()", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - .post() with basePath", async () => {
Deno.test("App - .post() with basePath", async () => {
const app = new App({ basePath: "/foo/bar" })
.post("/", () => new Response("ok"))
.post("/foo", () => new Response("ok"));
@@ -101,7 +101,7 @@ Deno.test("FreshApp - .post() with basePath", async () => {
expect(res.status).toEqual(200);
});
Deno.test("FreshApp - .patch()", async () => {
Deno.test("App - .patch()", async () => {
const app = new App<{ text: string }>()
.get("/", () => new Response("fail"))
.get("/foo", () => new Response("fail"))
@@ -117,7 +117,7 @@ Deno.test("FreshApp - .patch()", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - .patch() with basePath", async () => {
Deno.test("App - .patch() with basePath", async () => {
const app = new App({ basePath: "/foo/bar" })
.patch("/", () => new Response("ok"))
.patch("/foo", () => new Response("ok"));
@@ -135,7 +135,7 @@ Deno.test("FreshApp - .patch() with basePath", async () => {
expect(res.status).toEqual(200);
});
Deno.test("FreshApp - .put()", async () => {
Deno.test("App - .put()", async () => {
const app = new App<{ text: string }>()
.get("/", () => new Response("fail"))
.get("/foo", () => new Response("fail"))
@@ -151,7 +151,7 @@ Deno.test("FreshApp - .put()", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - .put() with basePath", async () => {
Deno.test("App - .put() with basePath", async () => {
const app = new App({ basePath: "/foo/bar" })
.put("/", () => new Response("ok"))
.put("/foo", () => new Response("ok"));
@@ -169,7 +169,7 @@ Deno.test("FreshApp - .put() with basePath", async () => {
expect(res.status).toEqual(200);
});
Deno.test("FreshApp - .delete()", async () => {
Deno.test("App - .delete()", async () => {
const app = new App<{ text: string }>()
.get("/", () => new Response("fail"))
.get("/foo", () => new Response("fail"))
@@ -185,7 +185,7 @@ Deno.test("FreshApp - .delete()", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - .delete() with basePath", async () => {
Deno.test("App - .delete() with basePath", async () => {
const app = new App({ basePath: "/foo/bar" })
.delete("/", () => new Response("ok"))
.delete("/foo", () => new Response("ok"));
@@ -203,7 +203,7 @@ Deno.test("FreshApp - .delete() with basePath", async () => {
expect(res.status).toEqual(200);
});
Deno.test("FreshApp - wrong method match", async () => {
Deno.test("App - wrong method match", async () => {
const app = new App<{ text: string }>()
.get("/", () => new Response("ok"))
.post("/", () => new Response("ok"));
@@ -219,7 +219,7 @@ Deno.test("FreshApp - wrong method match", async () => {
expect(await res.text()).toEqual("ok");
});
Deno.test("FreshApp - methods with middleware", async () => {
Deno.test("App - methods with middleware", async () => {
const app = new App<{ text: string }>()
.use((ctx) => {
ctx.state.text = "A";
@@ -237,7 +237,7 @@ Deno.test("FreshApp - methods with middleware", async () => {
expect(await res.text()).toEqual("A");
});
Deno.test("FreshApp - .mountApp() compose apps", async () => {
Deno.test("App - .mountApp() compose apps", async () => {
const innerApp = new App<{ text: string }>()
.use((ctx) => {
ctx.state.text = "A";
@@ -262,7 +262,7 @@ Deno.test("FreshApp - .mountApp() compose apps", async () => {
expect(await res.text()).toEqual("A");
});
Deno.test("FreshApp - .mountApp() self mount, no middleware", async () => {
Deno.test("App - .mountApp() self mount, no middleware", async () => {
const innerApp = new App<{ text: string }>()
.use((ctx) => {
ctx.state.text = "A";
@@ -288,7 +288,7 @@ Deno.test("FreshApp - .mountApp() self mount, no middleware", async () => {
});
Deno.test(
"FreshApp - .mountApp() self mount, with middleware",
"App - .mountApp() self mount, with middleware",
async () => {
const innerApp = new App<{ text: string }>()
.use(function B(ctx) {
@@ -320,7 +320,7 @@ Deno.test(
);
Deno.test(
"FreshApp - .mountApp() self mount, different order",
"App - .mountApp() self mount, different order",
async () => {
const innerApp = new App<{ text: string }>()
.get("/foo", (ctx) => new Response(ctx.state.text))
@@ -351,7 +351,7 @@ Deno.test(
},
);
Deno.test("FreshApp - .mountApp() self mount empty", async () => {
Deno.test("App - .mountApp() self mount empty", async () => {
const innerApp = new App<{ text: string }>()
.use((ctx) => {
ctx.state.text = "A";
@@ -369,7 +369,7 @@ Deno.test("FreshApp - .mountApp() self mount empty", async () => {
});
Deno.test(
"FreshApp - .mountApp() self mount with middleware",
"App - .mountApp() self mount with middleware",
async () => {
const innerApp = new App<{ text: string }>()
.use(function Inner(ctx) {
@@ -392,7 +392,7 @@ Deno.test(
},
);
Deno.test("FreshApp - catches errors", async () => {
Deno.test("App - catches errors", async () => {
let thrownErr: unknown | null = null;
const app = new App<{ text: string }>()
.use(async (ctx) => {
@@ -416,7 +416,7 @@ Deno.test("FreshApp - catches errors", async () => {
});
// TODO: Find a better way to test this
Deno.test.ignore("FreshApp - finish setup", async () => {
Deno.test.ignore("App - finish setup", async () => {
const app = new App<{ text: string }>()
.get("/", (ctx) => {
return ctx.render(<div>ok</div>);
@@ -439,7 +439,7 @@ Deno.test.ignore("FreshApp - finish setup", async () => {
expect(res.status).toEqual(500);
});
Deno.test("FreshApp - sets error on context", async () => {
Deno.test("App - sets error on context", async () => {
const thrown: [unknown, unknown][] = [];
const app = new App()
.use(async (ctx) => {
@@ -471,7 +471,7 @@ Deno.test("FreshApp - sets error on context", async () => {
expect(thrown[1][0]).toEqual(thrown[1][1]);
});
Deno.test("FreshApp - support setting request init in ctx.render()", async () => {
Deno.test("App - support setting request init in ctx.render()", async () => {
const app = new App<{ text: string }>()
.get("/", (ctx) => {
return ctx.render(<div>ok</div>, {
@@ -487,7 +487,7 @@ Deno.test("FreshApp - support setting request init in ctx.render()", async () =>
expect(res.headers.get("X-Foo")).toEqual("foo");
});
Deno.test("FreshApp - throw when middleware returns no response", async () => {
Deno.test("App - throw when middleware returns no response", async () => {
const app = new App<{ text: string }>()
.get(
"/",
@@ -502,7 +502,7 @@ Deno.test("FreshApp - throw when middleware returns no response", async () => {
expect(text).toContain("Internal server error");
});
Deno.test("FreshApp - adding Island should convert to valid export names", () => {
Deno.test("App - adding Island should convert to valid export names", () => {
const app = new App();
const islands = getIslandRegistry(app);
@@ -533,7 +533,7 @@ Deno.test("FreshApp - adding Island should convert to valid export names", () =>
});
});
Deno.test("FreshApp - overwrite default 404 handler", async () => {
Deno.test("App - overwrite default 404 handler", async () => {
const app = new App().get("/foo", () => new Response("foo"));
const server = new FakeServer(