From 1094904a0353f06ce0abea53d6617a4d0c9bb49a Mon Sep 17 00:00:00 2001 From: Offending Commit Date: Thu, 28 May 2026 13:43:31 -0500 Subject: [PATCH] test(web): wrap test harness in MetadataProvider to match production main.tsx wraps the app in DemoProvider > MetadataProvider, but the app.test.tsx render helpers only wrapped with DemoProvider. Since e490d91 added useMetadata() to Sidebar, the routed app threw "useMetadataContext must be used within MetadataProvider" in tests; the error boundary swallowed the tree and the first-load assertion failed. CI has been red on main since that commit. Mirror the production provider nesting in both render sites. --- packages/web/src/test/app.test.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/web/src/test/app.test.tsx b/packages/web/src/test/app.test.tsx index ae147e8..ec1a46c 100644 --- a/packages/web/src/test/app.test.tsx +++ b/packages/web/src/test/app.test.tsx @@ -3,6 +3,7 @@ import { createMemoryHistory, createRouter, RouterProvider } from "@tanstack/rea import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import { DemoProvider } from "@/context/DemoContext"; +import { MetadataProvider } from "@/context/MetadataContext"; import { useDemo } from "@/hooks/useDemo"; import { routeTree } from "@/routeTree.gen"; @@ -15,8 +16,10 @@ function renderAt(initialPath: string) { return render( - {/* biome-ignore lint/suspicious/noExplicitAny: test router type */} - + + {/* biome-ignore lint/suspicious/noExplicitAny: test router type */} + + , ); @@ -56,9 +59,11 @@ describe("Sidebar/useDemo availability across routes", () => { render( - {/* biome-ignore lint/suspicious/noExplicitAny: test router type */} - - + + {/* biome-ignore lint/suspicious/noExplicitAny: test router type */} + + + , );