MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / make

Function make

packages/react/src/org-slug-routing.test.ts:18–42  ·  view source on GitHub ↗
(initialPath = "/")

Source from the content-addressed store, hash-verified

16};
17
18const make = (initialPath = "/"): SpikeRouter => {
19 const rootRoute = createRootRoute();
20 const orgScope = createRoute({
21 getParentRoute: () => rootRoute,
22 path: "/{-$orgSlug}",
23 });
24 const indexRoute = createRoute({ getParentRoute: () => orgScope, path: "/" });
25 const policiesRoute = createRoute({ getParentRoute: () => orgScope, path: "/policies" });
26 const nsRoute = createRoute({
27 getParentRoute: () => orgScope,
28 path: "/integrations/$namespace",
29 });
30 const loginRoute = createRoute({ getParentRoute: () => rootRoute, path: "/login" });
31 const routeTree = rootRoute.addChildren([
32 orgScope.addChildren([indexRoute, policiesRoute, nsRoute]),
33 loginRoute,
34 ]);
35 // This local tree is NOT the package's registered console tree, so widen
36 // away the global Register types — the test asserts runtime semantics.
37 // oxlint-disable-next-line executor/no-double-cast -- boundary: a test-local route tree must escape the package-global router Register types
38 return createRouter({
39 routeTree,
40 history: createMemoryHistory({ initialEntries: [initialPath] }),
41 }) as unknown as SpikeRouter;
42};
43
44describe("optional org-slug segment", () => {
45 it("matches bare and slugged URLs with the same route", async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected