mengw15 opened a new pull request, #6526:
URL: https://github.com/apache/texera/pull/6526
### What changes were proposed in this PR?
Extends the existing Vitest spec for `AdminUserComponent`
(`frontend/src/app/dashboard/component/admin/user/admin-user.component.ts`,
codecov ~42%). The existing spec only covered creation and the email/comment
search helpers; this adds 13 tests for the previously-untested methods.
The shared `TestBed` setup now mocks `AdminUserService` and `FeedbackService`
(instead of the real services over `HttpClientTestingModule`), which keeps
`ngOnInit` deterministic and lets the new tests assert service interactions
directly. The eight existing tests are unchanged and still pass.
New behavior covered:
- **`addUser`** — calls the service and reloads the list (re-runs
`ngOnInit`).
- **inline-edit lifecycle** — `startEdit` loads a row's values; `saveEdit`
persists a change (and updates the local lists), no-ops when nothing
changed,
and surfaces a service error via the message service; `stopEdit` clears the
edit target; `reset` clears search state and restores the display list.
- **`updateRole`** — edits only the role and persists it.
- **display helpers** — `isUserActive` (recent-login window) and
`getAccountCreation` (seconds → ms, default 0).
- **feedback / quota** — `loadFeedbackCounts` + `getFeedbackCount` caching;
`clickToViewFeedbacks` and `clickToViewQuota` open the correct modal
content.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #6518
### How was this PR tested?
Extended unit tests, run locally in `frontend/` (all green; the failure path
was
verified by breaking an assertion to confirm the suite goes red):
```
ng test --watch=false --include
src/app/dashboard/component/admin/user/admin-user.component.spec.ts
# Tests 21 passed (21) (8 existing + 13 new)
eslint <spec> # clean
prettier --check # clean
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]