test(frontend): extend AdminUserComponent unit test coverage#6744
Conversation
Add tests for the user-admin actions (add/edit/save/delete, role changes, sort/filter) and their notification/error branches. Coverage 75% -> high.
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
This PR extends the Angular unit test coverage for AdminUserComponent (admin user management UI) by adding additional spec cases for edit focus behavior, error handling, searching, sorting, and role filtering—aligning with Issue #6737’s goal of covering user-admin actions and their branches.
Changes:
- Add
fakeAsync/tick-based tests to coverstartEdit’ssetTimeoutfocus + caret placement behavior. - Add additional negative/error-path coverage (e.g.,
saveEditerror fallback toerr.message) and null-tolerance coverage for search helpers. - Add direct unit coverage for sort comparator and role filter functions (tie-breakers, missing values, active/inactive ordering).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6744 +/- ##
============================================
+ Coverage 74.85% 75.19% +0.34%
Complexity 3447 3447
============================================
Files 1160 1160
Lines 45793 45795 +2
Branches 5069 5070 +1
============================================
+ Hits 34278 34437 +159
+ Misses 9868 9748 -120
+ Partials 1647 1610 -37
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
startEdit uses setTimeout(0) (a macrotask); rename the test to reflect the timer-based behavior accurately.
What changes were proposed in this PR?
Extends
admin-user.component.spec.tscovering the user-admin actions (add/edit/save/delete, role changes, sort/filter) and their notification/error branches. Coverage 75% -> high. No existing tests modified.Any related issues, documentation, discussions?
Closes #6737.
How was this PR tested?
ng test --include='**/admin-user.component.spec.ts'-> 40/40 passing.yarn format:cipasses.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])