mengw15 opened a new pull request, #6555:
URL: https://github.com/apache/texera/pull/6555

   ### What changes were proposed in this PR?
   
   Extends the existing `ComputingUnitSelectionComponent` spec
   (`frontend/src/app/workspace/component/power-button/`, codecov ~59%) to 
cover the
   previously-untested resource-display getters and a few small handlers. 
Follows
   `frontend/TESTING.md` and reuses the existing `makeComputingUnit` fixture.
   
   Adds 13 tests:
   
   - **resource accessors** — `getCurrentComputingUnit{Cpu,Memory}Usage`,
     `getCurrentComputingUnit{Cpu,Memory,Gpu}Limit`, 
`getCurrentComputingUnitJvmMemorySize`,
     `getCurrentSharedMemorySize`: read the selected unit's raw values, and 
return
     `"NaN"` for every accessor when nothing is selected.
   - **derived getters** — `getCpuLimit`/`getMemoryLimit` (numbers), 
`getGpuLimit`/
     `getJvmMemorySize`/`getSharedMemorySize`, 
`getCpuLimitUnit`/`getMemoryLimitUnit`/
     `getCpuUnit`/`getMemoryUnit`; 
`getCpuValue`/`getMemoryValue`/`getCpuPercentage`/
     `getMemoryPercentage` return 0 when metrics are unavailable; 
`getCpuStatus`/
     `getMemoryStatus` map to `"success"`; `getBadgeColor` and 
`getUnitStatusTooltip`
     map status → color/tooltip.
   - **misc handlers** — `trackByCuid`/`trackByIndex` identity, 
`cancelEditingUnitName`
     state reset, `openComputingUnitMetadataModal` opens the metadata modal 
with the
     unit as `nzData`, and `scrollToBottomOfPipModal` scrolls the deferred 
pip-log
     element (and is a safe no-op when it is absent).
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6551
   
   ### How was this PR tested?
   
   Extended Vitest spec, run locally in `frontend/` (whole file green, run 4× to
   confirm determinism; failure path verified by breaking an assertion). To stay
   deterministic, `scrollToBottomOfPipModal` is driven with fake timers and a
   stubbed `document.getElementById` (a plain stand-in object, restored after 
each
   test) rather than relying on jsdom layout.
   
   ```
   ng test --watch=false --include 
src/app/workspace/component/power-button/computing-unit-selection.component.spec.ts
   # Test Files 1 passed (1) / Tests 100 passed (100)
   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]

Reply via email to