Skip to content

Fix React warnings in PrivacyRequestFiltersBar jest tests#7443

Merged
gilluminate merged 2 commits intomainfrom
gill/fix-jest-react-warnings
Feb 24, 2026
Merged

Fix React warnings in PrivacyRequestFiltersBar jest tests#7443
gilluminate merged 2 commits intomainfrom
gill/fix-jest-react-warnings

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented Feb 20, 2026

Description Of Changes

Fix React unknown-prop warnings in the PrivacyRequestFiltersBar test suite caused by the MockAntSelect component spreading Ant Design-specific props (e.g. allowClear, maxTagCount, showSearch, filterSort) directly onto a native <select> DOM element.

Two issues were addressed:

  • Mock component moved outside jest.mock factorybabel-plugin-jest-hoist hoists mock factories and strips JSX/TypeScript parsing context, so the mock component with JSX must be defined at module scope and referenced from the factory
  • Explicit prop picking instead of spread — only valid HTML attributes (data-testid, aria-label, className, id) are forwarded to the native <select>, avoiding the need for a blocklist that breaks whenever Ant adds new props upstream

Code Changes

  • clients/admin-ui/src/features/privacy-requests/dashboard/PrivacyRequestFiltersBar.test.tsx - Refactored MockAntSelect to explicitly pick valid HTML props instead of spreading all props, and moved it outside the jest.mock factory to avoid babel hoisting issues

Steps to Confirm

  1. Run the test suite from clients/admin-ui:
npx jest --no-coverage --verbose src/features/privacy-requests/dashboard/PrivacyRequestFiltersBar.test.tsx

Expected: All 7 tests pass with zero console.error warnings about unrecognized DOM props

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Made with Cursor

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Feb 20, 2026 7:40pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Feb 20, 2026 7:40pm

Request Review

Co-authored-by: Cursor <cursoragent@cursor.com>
@gilluminate gilluminate marked this pull request as ready for review February 20, 2026 21:09
@gilluminate gilluminate requested a review from a team as a code owner February 20, 2026 21:09
@gilluminate gilluminate requested review from jpople and removed request for a team February 20, 2026 21:09
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 20, 2026

Greptile Summary

Fixed React unknown-prop warnings in the PrivacyRequestFiltersBar test suite by refactoring the MockAntSelect component. The fix addresses two key issues: moving the mock component outside the jest.mock factory to avoid babel hoisting issues with JSX/TypeScript parsing, and explicitly picking only valid HTML attributes (data-testid, aria-label, className, id) instead of spreading all props onto the native <select> element. This prevents Ant Design-specific props like allowClear, maxTagCount, showSearch, and filterSort from being passed to the DOM element, which was causing the console warnings.

The implementation correctly maintains all test functionality while eliminating the warnings. The approach of explicit prop picking is more maintainable than a blocklist approach since it won't break when Ant Design adds new props upstream.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are isolated to test infrastructure with no production code impact. The refactoring correctly addresses the stated problem by moving the mock component outside the hoisted factory and explicitly filtering props. All existing tests remain intact and the solution is well-documented in both code comments and the PR description. The fix follows React best practices and prevents DOM property warnings without affecting test behavior.
  • No files require special attention

Important Files Changed

Filename Overview
clients/admin-ui/src/features/privacy-requests/dashboard/PrivacyRequestFiltersBar.test.tsx Refactored MockAntSelect to fix React warnings by moving component outside jest.mock factory and explicitly picking valid HTML attributes instead of spreading all props
changelog/7443-fix-jest-react-warnings.yaml Added changelog entry documenting the fix for React unknown-prop warnings in test suite

Last reviewed commit: 975fd77

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@gilluminate gilluminate added this pull request to the merge queue Feb 24, 2026
Merged via the queue into main with commit dadf261 Feb 24, 2026
45 checks passed
@gilluminate gilluminate deleted the gill/fix-jest-react-warnings branch February 24, 2026 16:20
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