import { cleanup, fireEvent, render, screen } from "@solidjs/testing-library"; import { Outlet, RouterProvider, createMemoryHistory, createRootRoute, createRoute, createRouter, } from "@tanstack/solid-router"; import { afterEach, expect, test } from "vitest"; import { RouteErrorFallback } from "@/components/layout/route-error"; afterEach(cleanup); test("a page that throws is replaced in place and the shell stays", async () => { let failures = 1; const root = createRootRoute({ component: () => (
PAGE OK
; }, }); const router = createRouter({ routeTree: root.addChildren([page]), history: createMemoryHistory({ initialEntries: ["/"] }), defaultErrorComponent: RouteErrorFallback, }); render(() =>