chore: restructure repository into packages/ folder (#3197)

We're having a growing number of packages in this repository. This PR
moves them into a `packages/` directory like it's commonly done in other
projects.
This commit is contained in:
Marvin Hagemeister
2025-08-06 15:52:45 +02:00
committed by GitHub
parent 27e407a1e3
commit 815b1940e3
184 changed files with 94 additions and 82 deletions
@@ -0,0 +1,53 @@
// deno-lint-ignore-file require-await
import { trailingSlashes } from "./trailing_slashes.ts";
import { expect } from "@std/expect";
import { serveMiddleware } from "../test_utils.ts";
Deno.test("trailingSlashes - always", async () => {
const middleware = trailingSlashes("always");
const server = serveMiddleware(middleware, {
next: async () => new Response("ok"),
});
let res = await server.get("/");
await res.body?.cancel();
expect(res.status).toEqual(200);
expect(res.headers.get("Location")).toEqual(null);
res = await server.get("/foo");
await res.body?.cancel();
expect(res.status).toEqual(302);
expect(res.headers.get("Location")).toEqual("/foo/");
res = await server.get("/foo/bar");
await res.body?.cancel();
expect(res.status).toEqual(302);
expect(res.headers.get("Location")).toEqual("/foo/bar/");
res = await server.get("/foo/bar/");
await res.body?.cancel();
expect(res.status).toEqual(200);
expect(res.headers.get("Location")).toEqual(null);
});
Deno.test("trailingSlashes - never", async () => {
const middleware = trailingSlashes("never");
const server = serveMiddleware(middleware, {
next: async () => new Response("ok"),
});
let res = await server.get("/");
await res.body?.cancel();
expect(res.status).toEqual(200);
expect(res.headers.get("Location")).toEqual(null);
res = await server.get("/foo");
await res.body?.cancel();
expect(res.status).toEqual(200);
expect(res.headers.get("Location")).toEqual(null);
res = await server.get("/foo/");
await res.body?.cancel();
expect(res.status).toEqual(302);
expect(res.headers.get("Location")).toEqual("/foo");
});