The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
85c5fb2ec52b75a91d4915a61717ced425458a5e / Meng Wang <[email protected]>
test(frontend): cover UserComputingUnitListItemComponent template bindings 
(#7420)

### What changes were proposed in this PR?

Extends `UserComputingUnitListItemComponent`'s spec to exercise the row
through
the DOM. The class file is already at 100%, but the existing tests call
the
handlers directly and never click the row's buttons, so
`user-computing-unit-list-item.component.html` sat at ~52%.

10 added tests render the row and drive it via
`fixture.debugElement.query(By.css(...))`:

- **Buttons** — the rename button starts inline editing; clicking the
unit name opens the metadata modal (`NzModalService.create` spied); the
delete button emits the `deleted` output.
- **Inline rename** — `Escape` cancels and `Enter` confirms with the
typed value (both fired as real `KeyboardEvent`s), and a click inside
the input does not bubble to the row.
- **Sharing** — the share button is omitted while
`sharingComputingUnitEnabled` is off, and opens the share-access modal
when it is on.
- **Metrics popover** — the CPU/RAM rows render, and the GPU /
JVM-memory / shared-memory rows appear only when those limits are set
(covering both arms of their `*ngIf`s).

This lifts the template from **~52% to 100%** (statements *and*
branches); the
class stays at 100%.

Two things worth noting, both found by checking rather than assuming:

- The `Escape`/`Enter` tests dispatch **real** `KeyboardEvent`s. With
`triggerEventHandler("keydown.escape", …)` the handler does fire
(verified with a spy), but it bypasses Angular's key-filtering, so the
real dispatch is both more representative and what the coverage
reflects.
- The last uncovered line was reported as html:79, but reading the
coverage `statementMap` showed the uncovered statement actually spans to
**line 84** — the input's `(click)="$event.stopPropagation()"`. That is
what the added "click does not bubble" test covers.

**Determinism:** the added tests introduce no *new* `vi.useFakeTimers()`
usage
(one pre-existing test in this file already uses fake timers; nothing
was added
on top) — the component's `setTimeout` never runs in a synchronous test
body, and
layering fake timers over zone.js's patched timers is Node-version
dependent. No
layout/geometry assertions. Overlay contents are cleared in an
`afterEach` so no
popover DOM leaks into a later test (clearing `innerHTML` rather than
removing
the container, since CDK caches that element). The popover is
opened synchronously via `.injector.get(NzPopoverDirective).show()` +
`detectChanges()` — the pattern already used in
`user-dataset-staged-objects-list.component.spec.ts` — and hidden again
afterwards. The sharing flag is flipped through
`TestBed.inject(GuiConfigService)`
(the same DI instance the component holds, whose config object is
per-instance),
so nothing leaks between tests. No production code was changed.

### Any related issues, documentation, discussions?

Closes #7411

### How was this PR tested?

Extended unit tests, run locally in `frontend/`:

```
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 45 passed (45)   — 3 consecutive runs, 0 
flakes
# user-computing-unit-list-item.component.html: ~52% -> 100% (statements & 
branches)
prettier --write <spec>   # formatted
eslint  <spec>            # clean
```

The failure path was verified by deliberately breaking a new assertion
and
confirming the suite exits non-zero.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Report URL: https://github.com/apache/texera/actions/runs/31241212817

With regards,
GitHub Actions via GitBox

Reply via email to