Skip to content

Commit

Permalink
fix: PathRouteBuilder#any discards their exactRoute (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: uhyo <[email protected]>
  • Loading branch information
acid-chicken and uhyo authored Jan 15, 2022
1 parent 5d582c5 commit 00008dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/builder/PathRouteBuilder/PathRouteBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,16 @@ describe("PathRouteBuilder", () => {
});
expect(res.exactRoute.action({})).toBe("I am root");
});
it("root works with any route", () => {
const res = PathRouteBuilder.init()
.exact({
action: () => "I am root",
})
.any("id", {
action: ({ id }) => `id is ${id.slice(0, 8)}`,
});
expect(res.exactRoute.action({})).toBe("I am root");
})
describe("resolve", () => {
it("resolve root", () => {
const toplevel = PathRouteBuilder.init()
Expand Down
1 change: 1 addition & 0 deletions src/builder/PathRouteBuilder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export class PathRouteBuilder<
routeDefinition?.action
),
};
result.#exactRoute = this.#exactRoute
return result;
}

Expand Down

0 comments on commit 00008dc

Please sign in to comment.