mengw15 opened a new pull request, #8101:
URL: https://github.com/apache/texera/pull/8101
### What changes were proposed in this PR?
Extends `computing-unit-selection.component.spec.ts` over the
virtual-environment
block the issue lists — creating an environment, reconciling saved packages,
installing user packages, streaming pip output, and the unit-rename handlers
—
with 22 tests. Measured locally with `--coverage`:
| `computing-unit-selection.component.ts` | Before | After |
| --- | --- | --- |
| lines | 321/370 (86.76 %) | **363/370 (98.11 %)** |
| statements | 342/393 | **386/393** |
| branches | 136/187 (72.73 %) | **173/187 (92.51 %)** |
| functions | 114/127 | **127/127 (100 %)** |
**`createVirtualEnvironment`** — the duplicate-name guard now fires: three
cards,
one of them nameless so the scan has to survive `(pve.name ?? "").trim()`
before
it reaches the clash, and nothing is created.
**`installUserPackages`** — all three paths. A package with a name but no
operator,
and one with no version, each stop at *"Please specify an operator and
version…"*.
A batch with a blank name, a name that collides with a system package under a
different case (`NumPy` vs `numpy`), and one already installed in the
environment
is filtered down to nothing: both skip notices fire, no socket opens, and
the draft
rows are cleared. A card with no draft rows at all exercises the optional
chain.
A surviving package opens an install socket with the trimmed spec
(`["numpy==1.26.0"]`) and, on `__DONE__`, reloads the package list.
**`applySavedPveAsUpdate`** — the `?? ""` fallbacks on both sides of the
version
comparison: a card package with no version against a blank database version
(no
diff), against a pinned one (replaced), and one the database no longer lists
(deleted with an empty version). The `db.version ?? ""` side is only
reachable by
calling the method directly, since `parseDbPackages` always produces a
string; that
test says so.
**Also covered:** `parseDbPackages` with a null spec; `getPVEs` with a system
package carrying no `==`; `togglePackageDelete` on a versionless package;
`updatePrettyPipOutput` and both socket handlers starting from a card with no
output; `refreshUserPackages` on success and on failure; `deleteUserPackages`
draining its queue one package at a time and logging a failure without
stopping;
`confirmUpdateUnitName` for a unit that is neither listed nor selected;
`startEditingUnitName` focusing and selecting the rename box once it is in
the
document; the metadata subscription's unsaved-workflow and no-running-unit
arms;
and `onClickOpenShareAccess`.
**What is left, and why.** Seven lines and fourteen branch arms remain:
- 537-549, 569, 573 — the resource-formatting getters, which the issue puts
out of
scope (#6745 proposed exactly those and was closed as not planned).
- 998 — `(pkg.version ?? "").trim()` inside the install `map`. The guard
above it
rejects any package whose trimmed version is empty, so nothing reaching
the map
can have a nullish version.
- 1064, 1074 — `this.pves[index].pipOutput ?? ""` in the delete callbacks.
Line 1043
always seeds `pipOutput` with a string before the first callback runs.
- **1000-1004 is dead code.** `skippedMessages` is declared at 978, read at
1000 and
1001, and never written to anywhere in the repository — the skip notices
go through
`notificationService.error` at 987 and 992 instead.
`skippedMessages.length > 0` is
therefore always false. Left in place here since this PR changes no
production code;
it is worth removing separately.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #8100.
#7752 and #7944 also touch this spec; the three sets of additions land in
different
places in the file, so whichever merges second is a mechanical rebase.
### How was this PR tested?
`ng test --watch=false --include
src/app/workspace/component/power-button/computing-unit-selection.component.spec.ts`
— 131 passed (109 before, 22 new), repeated 3× for stability. `yarn
format:ci` clean.
Failure path verified by breaking one assertion in each of the 22 new tests:
22
failed / 109 passed, non-zero exit, no pre-existing test disturbed, then
restored to
green.
Determinism: the block's existing `FakeSocket` double is reused and its
`onmessage` / `onerror` are invoked by hand, so no connection is opened and
no timer
is waited on; every service call resolves through `of(...)` /
`throwError(...)`;
environment and package fixtures are rebuilt per test because these handlers
mutate
them in place; and the two tests that need a timer use `vi.useFakeTimers()`
with a
`finally` that restores the real clock.
### 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]