Skip to content

test(web): wrap test harness in MetadataProvider to match production#17

Merged
offendingcommit merged 1 commit into
mainfrom
test/wrap-harness-metadata-provider
May 28, 2026
Merged

test(web): wrap test harness in MetadataProvider to match production#17
offendingcommit merged 1 commit into
mainfrom
test/wrap-harness-metadata-provider

Conversation

@offendingcommit
Copy link
Copy Markdown
Owner

Problem

CI has been red on main since e490d91 ("add global metadata visibility toggle"). That commit added useMetadata() to Sidebar, but the test render helpers in app.test.tsx only wrapped with DemoProvider — not MetadataProvider.

Result: the routed app throws useMetadataContext must be used within MetadataProvider in tests, the route error boundary swallows the tree, and the first-load empty-state assertion fails.

Fix

Mirror the production provider nesting from main.tsx (QueryClient > Demo > Metadata > Router) in both render sites in app.test.tsx. No app code changes.

Verification

make check — lint + typecheck + 11/11 tests pass locally.

Follow-up

Branch protection let three consecutive red runs land on main. Worth enabling a required green-CI gate (tracked separately).

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.
@offendingcommit offendingcommit merged commit 6960bf4 into main May 28, 2026
2 checks passed
@offendingcommit offendingcommit deleted the test/wrap-harness-metadata-provider branch May 28, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant