Fix React warnings in PrivacyRequestFiltersBar jest tests#7443
Fix React warnings in PrivacyRequestFiltersBar jest tests#7443gilluminate merged 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryFixed React unknown-prop warnings in the 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
Important Files Changed
Last reviewed commit: 975fd77 |
Description Of Changes
Fix React unknown-prop warnings in the
PrivacyRequestFiltersBartest suite caused by theMockAntSelectcomponent spreading Ant Design-specific props (e.g.allowClear,maxTagCount,showSearch,filterSort) directly onto a native<select>DOM element.Two issues were addressed:
jest.mockfactory —babel-plugin-jest-hoisthoists mock factories and strips JSX/TypeScript parsing context, so the mock component with JSX must be defined at module scope and referenced from the factorydata-testid,aria-label,className,id) are forwarded to the native<select>, avoiding the need for a blocklist that breaks whenever Ant adds new props upstreamCode Changes
clients/admin-ui/src/features/privacy-requests/dashboard/PrivacyRequestFiltersBar.test.tsx- RefactoredMockAntSelectto explicitly pick valid HTML props instead of spreading all props, and moved it outside thejest.mockfactory to avoid babel hoisting issuesSteps to Confirm
clients/admin-ui:Expected: All 7 tests pass with zero
console.errorwarnings about unrecognized DOM propsPre-Merge Checklist
CHANGELOG.mdupdatedMade with Cursor