Skip to content

[Test] bUnit: Archive action behavior in CategoriesPage and StatusesPage #126

@mpaulosky

Description

@mpaulosky

Summary

Once the archive action is added to CategoriesPage and StatusesPage, this issue covers bUnit component tests verifying the correct admin-only behavior, confirmation dialog flow, and optimistic UI updates.

Test Files to Create

tests/Web.Tests.Bunit/Components/Categories/CategoriesPageArchiveTests.cs

  • ArchiveButton_AdminUser_IsVisible
  • ArchiveButton_NonAdminUser_IsNotVisible
  • ArchiveButton_Clicked_ShowsConfirmDialog
  • ConfirmDialog_Confirmed_CallsArchiveApiAndRemovesRow
  • ConfirmDialog_Cancelled_DoesNotCallApi
  • ArchiveApi_ReturnsError_ShowsErrorMessage

tests/Web.Tests.Bunit/Components/Statuses/StatusesPageArchiveTests.cs

  • Same six tests mirrored for the Statuses page

bUnit Setup Notes (follow existing pattern)

  • Use TestContext from bUnit
  • Mock CategoryApiClient / StatusApiClient via NSubstitute
  • Use AuthenticationStateProvider mock to simulate admin vs. non-admin
  • Reference existing tests/Web.Tests.Bunit/Components/ tests for pattern

Acceptance Criteria

  • All tests pass
  • Admin guard tested (visible/invisible correctly)
  • Confirmation flow tested end-to-end in bUnit
  • API error state tested

Depends On

Metadata

Metadata

Labels

go:yesReady to implementpriority:p2Next sprintrelease:backlogNot yet targetedsprint-3Sprint 3 — Full CRUD UI + ArchivesquadSquad triage inbox — Lead will assign to a membersquad:gimliAssigned to Gimli (Tester)squad:legolasAssigned to Legolas (Frontend Dev)type:choreMaintenance, refactoring, cleanup

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions