Skip to content

test(admin): add unit tests for email blocklist controller and admin panel page#20611

Open
vbudhram wants to merge 1 commit into
mainfrom
fxa-13595
Open

test(admin): add unit tests for email blocklist controller and admin panel page#20611
vbudhram wants to merge 1 commit into
mainfrom
fxa-13595

Conversation

@vbudhram
Copy link
Copy Markdown
Contributor

Because

  • email-blocklist.controller.ts and PageEmailBlocklist/index.tsx had no unit tests. Sibling features (domain-blocklist, rate-limiting) do.

This pull request

  • Adds email-blocklist.controller.spec.ts for list, add (valid input plus non-array, non-string, blank, > 768 chars, invalid regex syntax), remove (success, not-found, blank, non-string), and removeAll.
  • Adds PageEmailBlocklist/index.test.tsx for render, loading, sort order, load error, button disable, submit + reload, whitespace guard, add-error alert, single delete (success + error), delete-all confirm/cancel, and CSV/TXT upload.
  • Mirrors the test layout in PageDomainBlocklist and domain-blocklist.controller.spec.ts.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13595

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

@vbudhram vbudhram requested a review from a team as a code owner May 15, 2026 17:43
Copilot AI review requested due to automatic review settings May 15, 2026 17:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds missing unit test coverage for the email regex blocklist feature in both the admin server (controller) and admin panel UI, aligning coverage with existing sibling blocklist/rate-limiting features.

Changes:

  • Added NestJS unit tests for EmailBlocklistController covering list/add/remove/removeAll and validation edge cases.
  • Added React Testing Library tests for PageEmailBlocklist covering loading/error states, add/delete flows, delete-all confirmation, and CSV/TXT upload behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/fxa-admin-server/src/rest/email-blocklist/email-blocklist.controller.spec.ts Adds controller-level unit tests mirroring the existing domain blocklist controller test structure and validating email regex inputs.
packages/fxa-admin-panel/src/components/PageEmailBlocklist/index.test.tsx Adds UI unit tests for the email regex blocklist page, mirroring PageDomainBlocklist patterns and covering add/remove/delete-all/file-upload flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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