Skip to content

Add filter-count badge test for src/features/maintainers/components/pull-requests/PRFilterDropdown.tsx #518

Description

@Jagadeeshftw

📌 Description

src/features/maintainers/components/pull-requests/PRFilterDropdown.tsx (has a test file already) likely shows a badge/count of currently active filters on its trigger button. There's no test confirming that count stays accurate as filters are added/removed, which is an easy thing to get subtly wrong (off-by-one, stale count after a rapid toggle).

🧩 Requirements and context

  • Add a test asserting the badge count matches the number of active filters after adding one, adding several, and removing one.
  • Add a test that the badge is hidden (or shows 0/none) when no filters are active.
  • Add a test for rapid toggle sequences not leaving a stale count.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b test/pr-filter-dropdown-count-badge

2. Implement changes

  • Modify: src/features/maintainers/components/pull-requests/PRFilterDropdown.test.tsx — add the count-accuracy cases.

3. Test and commit

  • Run tests:
npm test -- run PRFilterDropdown
  • Cover edge cases: zero active filters, one filter, many filters, rapid add/remove toggling.
  • Include test output and details in the PR description.

Example commit message

test: add active-filter count badge accuracy coverage for PRFilterDropdown

✅ Acceptance criteria

  • Badge count always matches the actual number of active filters across all tested sequences.
  • Badge is hidden or shows a clear zero-state when nothing is active.
  • Existing filter-application behavior (independent of the badge) is unaffected.

🔒 Security notes

None beyond standard correctness/regression risk.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuefrontendFrontend / UI worktestingTests and coverage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions