Skip to content

feat: Archive action for CategoriesPage and StatusesPage with bUnit tests#137

Merged
mpaulosky merged 4 commits intomainfrom
copilot/add-archive-action-tests
Apr 15, 2026
Merged

feat: Archive action for CategoriesPage and StatusesPage with bUnit tests#137
mpaulosky merged 4 commits intomainfrom
copilot/add-archive-action-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

Adds admin-only archive (soft-delete) action to CategoriesPage and StatusesPage, including the full confirmation dialog flow and 12 bUnit tests covering all acceptance criteria.

API Client Layer

  • Added ArchiveAsync(string id) to ICategoryApiClient / IStatusApiClient and their HTTP implementations (HTTP DELETE /api/v1/categories/{id} and /api/v1/statuses/{id})

Page UI & Logic

  • Archive button rendered inside <AuthorizeView Roles="Admin"> — invisible to non-admins
  • Button triggers InitiateArchive() → sets _archiveTarget + _showArchiveConfirm = true
  • <ConfirmDialog> wired to ConfirmArchive() / CancelArchive()
  • On confirm: calls ArchiveAsync, reassigns list (forces Radzen DataGrid re-render via new reference + Reload()), or sets _errorMessage on failure
  • Inline #archive-error element surfaced for error state testing

Tests

Two new test classes, 6 tests each:

  • CategoriesPageArchiveTests / StatusesPageArchiveTests
    • ArchiveButton_AdminUser_IsVisible
    • ArchiveButton_NonAdminUser_IsNotVisible
    • ArchiveButton_Clicked_ShowsConfirmDialog
    • ConfirmDialog_Confirmed_CallsArchiveApiAndRemovesRow
    • ConfirmDialog_Cancelled_DoesNotCallApi
    • ArchiveApi_ReturnsError_ShowsErrorMessage

Existing Test Fix

CategoriesPageTests and StatusesPageTests constructors now call _ctx.AddAuthorization() — required because <AuthorizeView> was added to both pages and bUnit throws without registered IAuthorizationPolicyProvider.

Copilot AI changed the title [WIP] Add bUnit tests for archive action in CategoriesPage and StatusesPage feat: Archive action for CategoriesPage and StatusesPage with bUnit tests Apr 15, 2026
Copilot AI requested a review from mpaulosky April 15, 2026 03:23
Copilot AI and others added 4 commits April 15, 2026 10:18
- Add id attribute to archive button: id="archive-{cat.Id}"
- Change AuthorizeView from Policy="Admin" to Roles="Admin"
- Change ConfirmText from "Archive" to "Yes, Archive"
- Add archive-error div with conditional display
- Add _errorMessage field and error handling in HandleArchiveConfirm

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mpaulosky mpaulosky force-pushed the copilot/add-archive-action-tests branch from 4b0cdac to 939fc82 Compare April 15, 2026 17:26
@mpaulosky mpaulosky marked this pull request as ready for review April 15, 2026 17:26
Copilot AI review requested due to automatic review settings April 15, 2026 17:26
@mpaulosky mpaulosky enabled auto-merge (squash) April 15, 2026 17:26
@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Apr 15, 2026
@github-actions
Copy link
Copy Markdown

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

@mpaulosky mpaulosky merged commit aab2f9f into main Apr 15, 2026
22 of 23 checks passed
@mpaulosky mpaulosky deleted the copilot/add-archive-action-tests branch April 15, 2026 17:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.52%. Comparing base (3f1f553) to head (939fc82).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...eb/Components/Features/Statuses/StatusesPage.razor 0.00% 11 Missing and 2 partials ⚠️
...Components/Features/Statuses/StatusesPage.razor.cs 0.00% 10 Missing and 2 partials ⚠️
...omponents/Features/Categories/CategoriesPage.razor 0.00% 1 Missing and 1 partial ⚠️
...eb/Components/Features/Statuses/StatusApiClient.cs 0.00% 2 Missing ⚠️
...onents/Features/Categories/CategoriesPage.razor.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
- Coverage   54.55%   54.52%   -0.04%     
==========================================
  Files         128      128              
  Lines        2984     2986       +2     
  Branches      336      339       +3     
==========================================
  Hits         1628     1628              
+ Misses       1109     1108       -1     
- Partials      247      250       +3     
Files with missing lines Coverage Δ
...onents/Features/Categories/CategoriesPage.razor.cs 4.41% <0.00%> (-0.07%) ⬇️
...omponents/Features/Categories/CategoriesPage.razor 0.00% <0.00%> (ø)
...eb/Components/Features/Statuses/StatusApiClient.cs 80.95% <0.00%> (+7.03%) ⬆️
...Components/Features/Statuses/StatusesPage.razor.cs 4.47% <0.00%> (+0.06%) ⬆️
...eb/Components/Features/Statuses/StatusesPage.razor 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants