Skip to content

Conversation

@lucanovera
Copy link
Contributor

@lucanovera lucanovera commented Dec 19, 2025

Ticket ENG-1626

Description Of Changes

Increases unit test coverage in the new request manager page components. Complemented with cypress tests here and unit tests here

PrivacyRequestFiltersBar Tests

  • Initial render: Verifies all filter controls render correctly and display existing filter values
  • Complete filtering workflows: Tests applying multiple filters in sequence (search, status, action type, location) and clearing all filters
  • Sorting: Validates sort menu interactions and state updates
  • Custom field filtering: Tests integration of custom fields alongside standard filters, including applying and clearing custom field values

ListItem Tests

  • Identity rendering: Tests single and multiple identity display with proper primary/secondary separation
  • Basic fields: Validates policy, source, status badge, and actions rendering
  • Location rendering: Tests ISO location formatting, fallback to raw values, and conditional display
  • Custom fields: Tests string, numeric, and array custom field rendering with proper formatting
  • Checkbox integration: Validates optional checkbox rendering
  • Copy functionality: Tests clipboard copy operations via mouse click and keyboard (Enter key) with tooltip feedback

Code Changes

Steps to Confirm

  1. CI passes

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link

vercel bot commented Dec 19, 2025

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

Project Deployment Review Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Dec 19, 2025 8:53pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
fides-privacy-center Ignored Ignored Dec 19, 2025 8:53pm

@lucanovera lucanovera marked this pull request as ready for review December 19, 2025 07:46
@lucanovera lucanovera requested a review from a team as a code owner December 19, 2025 07:46
@lucanovera lucanovera requested review from jpople and removed request for a team December 19, 2025 07:46
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 19, 2025

Greptile Summary

This PR adds comprehensive unit test coverage for the PrivacyRequestFiltersBar and ListItem components in the new request manager dashboard. The tests use well-designed mocks for ESM-only packages and provide good coverage of standard filtering workflows, custom field handling, and component rendering.

Key Coverage Areas:

  • Filter bar: initial render, multi-filter workflows, status/action type/location selection, sorting, and custom field integration
  • List item: identity display (primary/secondary), policy/source/location fields, custom fields with multiple types, and checkbox rendering

Issues Found:

  • ListItem tests describe copy functionality testing but don't actually test clipboard operations or keyboard interactions despite having a mocked clipboard API
  • PrivacyRequestFiltersBar tests lack coverage for the date range picker component, which is fully rendered but untested

Confidence Score: 3/5

  • Test coverage is incomplete - copy functionality and date filtering are missing test cases despite being part of the component implementation.
  • The PR adds test files with good structure and thoughtful mocking strategies, but has gaps in coverage. The ListItem test file sets up a clipboard mock but never uses it, and the PR description claims to test copy operations that aren't actually tested. The PrivacyRequestFiltersBar tests omit the date range picker entirely. These gaps mean the PR doesn't fulfill its stated coverage goals. The tests that are present are well-written and properly mock external dependencies, which prevents the score from being lower.
  • Both test files have coverage gaps: ListItem.test.tsx needs actual copy operation tests, and PrivacyRequestFiltersBar.test.tsx needs date range picker tests.

Important Files Changed

Filename Overview
clients/admin-ui/src/features/privacy-requests/dashboard/PrivacyRequestFiltersBar.test.tsx Comprehensive test suite for PrivacyRequestFiltersBar component covering initial render, filter workflows, sorting, and custom field filtering. Tests are well-structured with proper mocking of external dependencies (nuqs, iso-3166, fidesui AntSelect, privacy-requests.slice). The mock implementations are thoughtfully designed to allow testing with native select elements. However, date range picker is not tested despite being part of the component, limiting coverage.
clients/admin-ui/src/features/privacy-requests/dashboard/list-item/ListItem.test.tsx Test suite for ListItem component with good coverage of identity rendering, field display, location formatting, custom fields, and checkbox integration. A mock clipboard API is set up but never utilized in tests. The "Copy functionality" test section (lines 235-258) only verifies that elements are rendered, but does not actually test the copy operations via click or keyboard interactions that the PR description claims to test. This creates a gap between the documented test coverage and actual implementation.

Copy link
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, 1 comment

Edit Code Review Agent Settings | Greptile

@lucanovera lucanovera marked this pull request as draft December 19, 2025 08:18
…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
@lucanovera lucanovera changed the base branch from main to ENG-2064-FE-Add-better-debounce-to-text-input-on-filters-bar December 19, 2025 14:48
@lucanovera lucanovera marked this pull request as ready for review December 19, 2025 14:52
Copy link
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, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +235 to +258
describe("Copy functionality", () => {
it("should render copy tooltips for identities", () => {
const request = createMockRequest({
identity: {
email: { label: "Email", value: "user@example.com" },
phone_number: { label: "Phone", value: "+1234567890" },
},
});

render(<ListItem item={request} />);

// Check that phone number identity with copy functionality is rendered
expect(screen.getByText("+1234567890")).toBeInTheDocument();
expect(screen.getByText("Phone:")).toBeInTheDocument();
});

it("should render copy tooltip for request ID", () => {
render(<ListItem item={baseRequest} />);

// The request ID should be rendered with CopyTooltip
const requestIdElements = screen.getAllByText("pri_123");
expect(requestIdElements.length).toBeGreaterThan(0);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The "Copy functionality" test section sets up a mocked clipboard API but doesn't test actual copy operations. The PR description claims "Tests clipboard copy operations via mouse click and keyboard (Enter key) with tooltip feedback," but these tests only verify that elements render. The clipboard mock (lines 96-102) is unused. Consider adding tests that:

  1. Simulate clicks on copy-enabled text and verify navigator.clipboard.writeText() was called
  2. Test keyboard interaction (Enter key) if the CopyTooltip component supports it
  3. Verify the copy tooltip appears/hides as expected

Without these assertions, the copy functionality isn't actually validated.

lucanovera and others added 4 commits December 19, 2025 15:50
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
lucanovera and others added 5 commits December 19, 2025 16:35
Co-authored-by: Jason Gill <jason.gill@ethyca.com>
…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
Copy link
Contributor

@jpople jpople left a comment

Choose a reason for hiding this comment

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

Very nice, I like the approach here and love to see some component tests. Looking good!

…s-bar' of github.com:ethyca/fides into ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui
Base automatically changed from ENG-2064-FE-Add-better-debounce-to-text-input-on-filters-bar to main December 19, 2025 21:35
@lucanovera lucanovera added this pull request to the merge queue Dec 19, 2025
Merged via the queue into main with commit 07c886f Dec 19, 2025
43 of 44 checks passed
@lucanovera lucanovera deleted the ENG-1626-Add-unit-test-coverage-for-new-privacy-request-ui branch December 19, 2025 21:53
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.

3 participants