Skip to content

Commit

Permalink
test(proxy): add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Sep 26, 2024
1 parent 60f7334 commit e55159e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions packages/~/proxy/api/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -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");
});
3 changes: 2 additions & 1 deletion packages/~/proxy/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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": []
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down

0 comments on commit e55159e

Please sign in to comment.