Skip to content

[Refactor] Reuse webview render helper in remaining settings specs - #1204

Merged
edelauna merged 1 commit into
mainfrom
feature/webview-render-helper-3-26vxix3b5tqmz
Aug 9, 2026
Merged

[Refactor] Reuse webview render helper in remaining settings specs#1204
edelauna merged 1 commit into
mainfrom
feature/webview-render-helper-3-26vxix3b5tqmz

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

N/A: Phase 3 webview test-utils refactor — final settings batch.

Description

Completes the webview lane's render-helper migration after #1203. The four heavier settings specs stop hand-wrapping renders in QueryClientProvider and go through the shared renderWithExtensionState helper:

  • SettingsView.change-detection.spec.ts.tsx renders pass their existing queryClient (with retry config) via the helper's options
  • SettingsView.unsaved-changes.spec.tsx — same
  • ModelPicker.spec.tsx — same
  • ModelPicker.deprecated.spec.tsx — same

Notes for reviewers:

  • Each converted render passes { queryClient } so the file's existing client and its retry configuration are preserved exactly.
  • rerender(...) calls now pass only the inner element; RTL reuses the helper's wrapper.
  • The three files that mock @src/context/ExtensionStateContext with only useExtensionState gained a one-line local passthrough ExtensionStateContextProvider — required for the helper's provider import to resolve against the mock. ModelPicker.deprecated has no extension-state mock and uses the real provider through the helper.
  • With [Refactor] Reuse webview render helper in chat and settings specs #1203, no spec under webview-ui/src/components/**/__tests__ hand-wraps QueryClientProvider anymore.

Component mocks, fixtures, and assertions stay local and unchanged. This is a test-only refactor with no intended runtime or user-facing behavior change.

Test Procedure

  • pnpm exec vitest run src/components/settings/__tests__/SettingsView.change-detection.spec.tsx src/components/settings/__tests__/SettingsView.unsaved-changes.spec.tsx src/components/settings/__tests__/ModelPicker.spec.tsx src/components/settings/__tests__/ModelPicker.deprecated.spec.tsx from webview-ui (26 tests passed)
  • pnpm test (webview suite: 144 files, 1,590 tests passed; extension suite: 445 files, 7,355 tests passed)
  • pnpm lint
  • pnpm check-types

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): Not applicable; this is a test-only refactor with no rendered UI change.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

Not applicable; no product UI changed.

Videos (interaction / animation only)

Not applicable; no product interaction changed.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Additional Notes

No changesets were added. Author self-review found no behavior or scope regressions.

Get in Touch

Mention @roomote on this PR for follow-up requests.

Co-authored-by: Roomote <roomote@roomote.dev>
@zoomote

zoomote Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Author self-review summary:

  • Scope: 4 settings spec files, 105 insertions / 192 deletions. Helper adoption only — component mocks, fixtures, and assertions unchanged.
  • Every converted render passes { queryClient }, preserving each file's existing client and retry configuration exactly (verified per call site).
  • All rerender(...) calls now pass only the inner element; RTL reuses the helper's wrapper.
  • Passthrough ExtensionStateContextProvider additions in change-detection, unsaved-changes, and ModelPicker.spec are one line each and local to the existing mock factories; ModelPicker.deprecated uses the real provider through the helper.
  • No QueryClientProvider remains in these files; with [Refactor] Reuse webview render helper in chat and settings specs #1203, the hand-wrapped QueryClient pattern is gone from webview-ui/src/components/**/__tests__.
  • Validation: 26/26 focused tests; full pnpm test (webview 144 files / 1,590 tests; extension 445 files / 7,355 tests); pnpm lint; pnpm check-types.
  • No production code, docs, or changesets touched. Visual proof not applicable (test-only refactor).

Per initiative policy, not approving this Roomote-authored PR — leaving review to a human maintainer.

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review August 9, 2026 00:52
@edelauna
edelauna enabled auto-merge August 9, 2026 00:55
@edelauna
edelauna added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 03db526 Aug 9, 2026
26 checks passed
@edelauna
edelauna deleted the feature/webview-render-helper-3-26vxix3b5tqmz branch August 9, 2026 01:08
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.

2 participants