diff --git a/packages/~/proxy/api/src/index.test.ts b/packages/~/proxy/api/src/index.test.ts new file mode 100644 index 00000000..dc4c9e75 --- /dev/null +++ b/packages/~/proxy/api/src/index.test.ts @@ -0,0 +1,17 @@ +// + +import { expect, test } from "bun:test"; +import { Hono } from "hono"; +import proxy from "./index"; + +// + +test('redirect to "/hello"', async () => { + const response = await new Hono() + .get("/hello", ({ text }) => text("world")) + .route("/proxy", proxy) + .request("/proxy/localhost:3000/hello"); + + expect(response.status).toBe(302); + expect(response.headers.get("location")).toBe("http://localhost:3000/hello"); +}); diff --git a/packages/~/proxy/api/tsconfig.json b/packages/~/proxy/api/tsconfig.json index 5ef889db..5c9830cc 100644 --- a/packages/~/proxy/api/tsconfig.json +++ b/packages/~/proxy/api/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { - "outDir": "./node_modules/.cache/tsc" + "outDir": "./node_modules/.cache/tsc", + "types": ["bun-types"] }, "extends": "@~/config.typescript/api/tsconfig.json", "references": [] diff --git a/tsconfig.json b/tsconfig.json index 07d18a2c..a75337c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,8 @@ "include": [ "bin/src", "build.ts", - "packages/~/*/*/*/src/**/*.tsx", - "packages/~/*/*/src/**/*.tsx" + "packages/~/*/*/*/src", + "packages/~/*/*/src" ], "references": [ { "path": "packages/~/app/api/tsconfig.json" },