mengw15 opened a new pull request, #6391:
URL: https://github.com/apache/texera/pull/6391
### What changes were proposed in this PR?
Adds a Vitest spec for `UserComputingUnitListItemComponent`
(`frontend/src/app/dashboard/component/user/user-computing-unit/user-computing-unit-list-item/`),
which had no spec (codecov ~9%). The spec follows `frontend/TESTING.md`
(TestBed +
`fixture.detectChanges()` for template coverage) and mirrors the sibling
`user-computing-unit.component.spec.ts` /
`user-dataset-list-item.component.spec.ts`
mocking conventions.
20 behavior-focused tests:
- **create / `ngOnInit`** — renders the template; populates `gpuOptions` from
`getComputingUnitLimitOptions`, and notifies on that request failing.
- **`entry` / `unit` getters** — throw before `entry` is set / when the
entry has
no computing unit; return the bound values otherwise.
- **`startEditingUnitName`** — rejects non-owners with an error; enters edit
mode
for owners.
- **`cancelEditingUnitName`** — clears the editing state.
- **`confirmUpdateUnitName`** — rejects an empty name without calling the
endpoint;
on success renames with the *trimmed* name, updates
`entry.computingUnit.name`
(only when the cuid matches), refreshes the list, and resets editing; on
failure
notifies, leaves the name unchanged, and still resets editing.
- **`onClickOpenShareAccess`** — delegates to
`ComputingUnitActionsService.openShareAccessModal(cuid, false)`.
- **`deleted` output** — is an `EventEmitter` and fires when the delete
button is clicked.
- **resource getters** — read limits straight from the unit and return zero
usage
values when metrics are unavailable.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #6389
### How was this PR tested?
New Vitest spec, run locally in `frontend/` (all green; failure path
verified by
deliberately breaking an assertion to confirm the suite goes red):
```
ng test --watch=false --include
src/app/dashboard/component/user/user-computing-unit/user-computing-unit-list-item/user-computing-unit-list-item.component.spec.ts
# Test Files 1 passed (1) / Tests 20 passed (20)
eslint <spec> # clean
prettier --check # clean
```
Services (`WorkflowComputingUnitManagingService`, `NotificationService`,
`ComputingUnitStatusService`, `ComputingUnitActionsService`) are mocked, so
the
spec makes no network calls and touches no live services.
### 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]