Skip to content

add unit test coverage for ComputingUnitSelectionComponent resource-formatting getters #6745

Description

@mengw15

Task Summary

ComputingUnitSelectionComponent sits at codecov ~66% (130 uncovered lines) — its spec covers the interaction flows but leaves the resource-formatting and status-display getters untested. Extend the spec to cover those pure getters. jsdom/Vitest; see frontend/TESTING.md.

Behavior to add

ComputingUnitSelectionComponent (frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts, codecov ~66% — EXTEND; spec covers flows, not the getters)

Scope: the pure resource-formatter and status-display getters — each delegates to a pure util from the current computing unit's values, so seed the component's selected unit (or stub the getCurrentComputingUnit* accessors) and assert the returned value:

  • CPU: getCpuLimit / getCpuValue / getCpuUnit / getCpuLimitUnit / getCpuPercentage / getCpuStatus — assert formatted numbers/units and that getCpuStatus maps a percentage to "success" | "exception" | "active" | "normal".
  • Memory: getMemoryLimit / getMemoryValue / getMemoryUnit / getMemoryLimitUnit / getMemoryPercentage / getMemoryStatus — same shape.
  • Other resources: getGpuLimit / getJvmMemorySize / getSharedMemorySize.
  • Status/display: computeStatus / getButtonText / getBadgeColor(status) / getUnitStatusTooltip / isComputingUnitRunning / isSelectedUnit / isCreateDisabled(pve) / cannotSelectUnit — assert the string/boolean for representative inputs.
  • Trivial: trackByCuid / trackByIndex return the identity key.

Out of scope (separate issue): the WebSocket/HTTP/service-driven methods (runPveWebSocket, refreshUserPackages, refreshAvailableDbPves, createVirtualEnvironment, installUserPackages, terminateComputingUnit, selectComputingUnit) — they need service mocks.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions