Skip to content

Commit

Permalink
add test case for nested router
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Jun 6, 2024
1 parent 9323adf commit 3b78466
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rt_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ Deno.test("createRouter preserves state", async () => {
);
assertEquals(await response.text(), "Hello, Alice!");
});

const nestedRouter = createRouter()
.get(
"/*",
(ctx) => statefulRouter.fetch(ctx.request),
);

Deno.test("createRouter nests routers", async () => {
const response = await nestedRouter.fetch(
new Request("http://localhost/Alice"),
);
assertEquals(await response.text(), "Hello, Alice!");
});

0 comments on commit 3b78466

Please sign in to comment.