MCPcopy Create free account
hub / github.com/bytebase/bytebase / runCatchAllLoader

Function runCatchAllLoader

frontend/src/react/router/guard.test.ts:80–94  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

78}
79
80async function runCatchAllLoader(path: string): Promise<Response> {
81 const matched = matchRoutes(routes, path);
82 const leafRoute = matched?.at(-1)?.route;
83 if (typeof leafRoute?.loader !== "function") {
84 throw new Error(`No loader matched ${path}`);
85 }
86 const url = new URL(`https://app.example.com${path}`);
87 return leafRoute.loader({
88 request: new Request(url),
89 url,
90 pattern: "*",
91 params: {},
92 context: {},
93 }) as Response | Promise<Response>;
94}
95
96describe("rootGuard", () => {
97 test("error page is allowed directly", () => {

Callers 1

guard.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected