mengw15 opened a new issue, #8099:
URL: https://github.com/apache/texera/issues/8099

   ### Task Summary
   
   `computing-unit-selection.component.html` has **51 uncovered template lines 
at 77.2 %**. Its spec is substantial — 98 `it()` blocks, 16 `detectChanges()` 
calls — but the unit list and the metrics popover are never rendered with data, 
so the per-unit row controls and every metric row sit unexecuted. The spec does 
**not** call `TestBed.overrideComponent`, so template coverage attributes 
normally and the gap is genuinely reachable.
   
   Pure EXTEND. Vitest/jsdom; see `frontend/TESTING.md` and 
`frontend/AGENTS.md`.
   
   ### Behavior to add
   
   **Computing-unit selection template** 
(`frontend/src/app/workspace/component/power-button/computing-unit-selection.component.html`,
 codecov 77.2 % — EXTEND `computing-unit-selection.component.spec.ts`)
   
   Mechanics throughout: seed the unit list and the selected unit, 
`fixture.detectChanges()`, then query with 
`fixture.debugElement.query(By.css(...))` and fire events with 
`.triggerEventHandler(...)` rather than calling handlers on the instance.
   
   - **Unit list rows** (116–180) — seed at least two units so the `*ngFor` 
expands, then cover:
     - selecting a row: `(click)="selectedComputingUnit = unit; 
selectComputingUnit(workflowId, unit…)"` (116) — assert the selection changed 
and the service was called;
     - the `[avatar]` bindings for both the selected unit (72) and each row 
(119), including the `selectedComputingUnit ? … : ''` fallback when nothing is 
selected;
     - the inline rename input (141–146): `(focusout)` and `(keyup.enter)` both 
call `confirmUpdateUnitName(cuid, value)`, `(keyup.escape)` calls 
`cancelEditingUnitName()`, and `[value]="editingUnitName"` seeds it. Fire all 
three events and assert the confirm/cancel behaviour differs;
     - the share icon (171–180): `onClickOpenShareAccess(cuid)` with 
`$event.stopPropagation()` — assert the share handler ran **and** that the 
row's own click handler did not also fire.
   - **Metrics popover** (27, 227–262) — 
`[nzPopoverContent]="selectedComputingUnit ? metricsTemplate : undefined"` (27) 
means the popover only has content when a unit is selected; cover both. With a 
unit selected, render the metrics block and assert:
     - the CPU row (229–233): value, `/ {{getCpuLimit()}} 
{{getCpuLimitUnit()}}`, and the percentage;
     - the RAM row (236–241): the same three parts;
     - the three conditional rows, each with its own guard — GPU 
`*ngIf="getGpuLimit() !== '0' && getGpuLimit() !== 'NaN' && 
showGpuSelection()"` (244–248), JVM memory `*ngIf="getJvmMemorySize() !== '0' 
&& … !== 'NaN'"` (250–254), and shared memory (256–260). **Cover each guard on 
both sides** — a unit whose limits make the row render, and one whose `'0'` / 
`'NaN'` value hides it. That is what exercises the individual clauses rather 
than the whole `&&` at once.
   - **PVE modal close** (278) — `closePveModal()` fired from the rendered 
control.
   
   Determinism notes:
   - The metric values run through `| number:'1.4-4'` pipes; assert on the 
rendered text of a value you control, or on the presence of the row — never on 
a computed percentage derived from live usage.
   - Do not assert on `DatePipe`-rendered text, and make no layout or geometry 
assertions (`getBoundingClientRect` returns zeros under jsdom).
   - Stub the computing-unit and share services; emit with `of(...)` and flush 
HTTP synchronously with `HttpClientTestingModule`.
   - `fixture.destroy()` in `afterEach` so pollers and `@UntilDestroy` 
subscriptions stop; `vi.restoreAllMocks()` in `afterEach`.
   - Clone unit fixtures per test — the rename handler mutates the unit in 
place.
   
   Note #7752 is open and touches this component — rebase before finishing.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
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]

Reply via email to