UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

36 lines (35 loc) 1.34 kB
import { describe, expect, it } from "vitest"; import { getRoutes } from "./getRoutes.native.js"; import { getSitemap } from "./sitemap.native.js"; import { getMockContext } from "../testing-utils.native.js"; describe("getSitemap", function () { it("maps the route tree to a public sitemap shape", function () { var routes = getRoutes(getMockContext(["_layout.tsx", "index.tsx", "(app)/_layout.tsx", "(app)/thread/[id].tsx", "docs/[...slug].tsx"])); var sitemap = getSitemap(routes); expect(sitemap).toMatchObject({ contextKey: "./_layout.tsx", href: "/", isInternal: false, isGenerated: false, children: expect.arrayContaining([expect.objectContaining({ contextKey: "./index.tsx", filename: "index", href: "/" }), expect.objectContaining({ contextKey: "./(app)/_layout.tsx", filename: "(app)/_layout", href: "/(app)", children: expect.arrayContaining([expect.objectContaining({ contextKey: "./(app)/thread/[id].tsx", filename: "thread/[id]", href: "/(app)/thread/[id]" })]) }), expect.objectContaining({ contextKey: "./docs/[...slug].tsx", filename: "docs/[...slug]", href: "/docs/[...slug]" })]) }); }); }); //# sourceMappingURL=sitemap.test.native.js.map