Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
willybrauner committed Nov 9, 2023
1 parent 9aee243 commit 5d1ae14
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tests/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,24 @@ describe("URLs and paths", () => {
"/hello/foo/bla/no",
)
})

it("should return full URL with only page name with base URL", () => {
// prettier-ignore
const routes = [
{ path: "/a", name: "a-page" },
{
path: "/b",
name: "b-page",
children: [
{ path: "/c", name: "c-page" },
{ path: "/d", name: "d-page" }
],
},
]
expect(getUrlByRouteName(routes, { name: "b-page" })).toBe("/b")
expect(getUrlByRouteName(routes, { name: "b-page" }, "/test/")).toBe("/test/b")
expect(getUrlByRouteName(routes, { name: "c-page" }, "/test/")).toBe("/test/b/c")
})
})

describe("getLangPath", () => {
Expand Down

0 comments on commit 5d1ae14

Please sign in to comment.