Repository navigation
test(frontend): drive the dataset detail template through the DOM - #7681
Merged
Merged
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7681 +/- ##
============================================
+ Coverage 90.14% 90.28% +0.14%
Complexity 4415 4415
============================================
Files 1176 1176
Lines 47133 47133
Branches 5285 5285
============================================
+ Hits 42487 42555 +68
+ Misses 2879 2822 -57
+ Partials 1767 1756 -11
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 17, 2026
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Aug 18, 2026
…rds (apache#7733) ### What changes were proposed in this PR? Two small frontend targets. The headline is the console frame template, whose line percentage hid the real gap: | File | Before | After | |---|---|---| | `console-frame.component.html` | branches **0/8**, functions **5/9** | **8/8 branches, 9/9 functions** | | `console-frame.component.ts` | 96.9% lines, 95% functions | **65/65 lines (100%), 20/20 functions** | | `preset.service.ts` | 94.8% lines, 90.5% branches | **111/115 lines, 70/74 branches** | 7 tests added. Covered: `ngOnChanges` adopting a new operator id, the empty-list fallback, typing into the command box through a real `input` event and submitting, narrowing the send by picking a worker in the `nz-select` overlay, the settings dropdown's two toggles, and two `preset.service` validation guards. **This is 8 lines by line-count.** What earns it is the branch and function coverage on the template — every interactive control in the console frame was previously unexercised — and that all 8 mutations die. ### Not an apache#7458 case, and worth saying so The obvious guess for a dark template here is the `TestBed.overrideComponent` attribution loss behind merged PRs apache#7535, apache#7627, apache#7629, apache#7661, apache#7681 and apache#7727. It is not: the existing spec uses `imports: [ConsoleFrameComponent, ...]` with no override, and the coverage map shows bindings executing counted (the `*ngFor` statement has 124 hits). So this extends the existing TestBed rather than appending a separate one — the opposite call from apache#7727, for a checkable reason. ### Verification 8 mutations, **8 killed, no survivors**, each applied one at a time with the anchor asserted unique, reverted and `git diff`-checked between every run. All failures are assertion failures, never compile errors. | Mutation | Killed by | |---|---| | **exchange** `[(ngModel)]="showTimestamp"` and `"showSource"` | toggles the timestamp and source tags independently | | `[(ngModel)]="targetWorker"` -> one-way | narrows the command to the worker picked | | `[(ngModel)]="command"` -> one-way | sends the text typed into the command box | | **exchange** `currentValue` and `previousValue` | `ngOnChanges` adopts the newly bound operator id | | remove the `\|\| []` fallback | falls back to an empty list for an unseen operator | | **exchange** the `"error"` and `"info"` switch bodies | refuses to save with an 'info' severity | | `push(replacementPreset)` -> `push(originalPreset)` | stores the replacement when the dictionary has no entry yet | | give `"warning"` a default toast instead of throwing | refuses to save with a 'warning' severity | The first one is the reason the fixture is not degenerate: the kill lands on the *independence* assertion (timestamp off, source still on). Turning both toggles off at once would have survived the exchange. One mechanical note worth recording: the settings dropdown's menu is projected into a CDK overlay wired in `ngAfterViewInit` behind an `auditTime(150)`, so its fixture must be created **inside** `fakeAsync`. Created in a plain `beforeEach`, the timers escape `tick()`, the overlay never attaches, and the switch count is 0 — a test written against that state would pass while asserting nothing. ### Deliberately not included, with evidence - **`updatePreset` (lines 184-190) is dead *and* buggy**, so no test was written for it. It has zero call sites repo-wide outside its own spec. And `indexOf(presets, originalPreset)` is lodash reference-equality against a freshly `JSON.parse`d array, so it always returns `-1`: `splice(-1, 1)` deletes the **wrong** preset and `presets[-1] = ...` is a silent no-op that `JSON.stringify` drops. Its sibling `updateOrCreatePreset` carries the comment *"presets are freshly JSON-parsed, so reference-based indexOf would miss"* and uses `findIndex(isEqual)` — the fix was applied there and not here. Any test would cement the bug. - **`console-frame.component.html` lines 54 and 59 are structurally unreachable**: `#checkedTemplate` and `#unCheckedTemplate` are each declared **twice** (36/41 and 53/58), and both `nz-switch`es resolve to the first pair. The coverage map proves it — statements at 37/42 have 46 hits (2 switches x 23 fixtures) while 54/59 have 0. - Two `.ts` branch arms are guard-guaranteed: `renderConsole()`'s `if (this.operatorId)` already forces the ternary's true leg, and `#consoleList` is unconditional in the template so its `@ViewChild` is always set in a rendered fixture. A third, weaker observation, reported and not pinned: `ngOnChanges` does `this.operatorId = changes.operatorId?.currentValue`, so an `ngOnChanges` fired by a change to `consoleInputEnabled` alone would wipe `operatorId` to `undefined` and silently disable the debug console. `ResultPanelComponent` always sets both inputs together, so it is latent rather than triggered today; the new test pins only the normal path. No production file is touched. ### Any related issues, documentation, discussions? Closes apache#7732 ### How was this PR tested? ``` npx ng test --watch=false --include="**/preset.service.spec.ts" --include="**/console-frame.component.spec.ts" ``` ``` Test Files 2 passed (2) ``` 86 tests green in the two target specs; 174 green including the consumer specs `result-panel.component.spec.ts` and `preset-wrapper.component.spec.ts`, checked for CDK-overlay leakage across specs. `yarn format:ci` passes. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
This was referenced Aug 19, 2026
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Aug 22, 2026
…mponents (apache#7833) ### What changes were proposed in this PR? Test-only. **No production file changes.** Both templates here reached 100% in merged PRs apache#7681 and apache#7772, which lifted these `.ts` files as a side effect — so what remained was branch arms and uncalled handlers rather than whole untested regions. Measured with istanbul JSON from `--coverage --coverage-reporters=json`, one spec at a time, identical `--include` filter for the before and after runs: **`dataset-detail.component.ts`** | | before | after | |---|---|---| | statements | 425/430 (98.84%) | **428/430 (99.53%)** | | branch arms | 177/203 (87.19%) | **193/203 (95.07%)** | | functions | 115/120 (95.83%) | **120/120 (100%)** | In the Codecov framing used in the issue: 5 missed lines + 24 partial → **2 missed + 9 partial**. 15 of the 24 partial lines are now fully covered. Closed 3 of 5 missed statement lines, **16 of 26 missed branch arms**, and **5 of 5 missed functions**. Its template is re-confirmed at 455/455 statements and 46/46 branch arms, so nothing was added there. **`user-dataset-version-creator.component.ts`** | | before | after | |---|---|---| | statements | 58/63 (92.06%) | **62/63 (98.41%)** | | branch arms | 22/24 (91.67%) | **24/24 (100%)** | | functions | 14/16 (87.50%) | 15/16 (93.75%) | Codecov framing: 5 missed + 2 partial → **1 missed + 0 partial**. Tests **188 → 214**: dataset-detail 173 → 192, version-creator 15 → 18, plus the repair round below. ### An honest correction to the second target's count The assessment called it 5 lines + 2 arms. The real closable count is **4 statements + 2 arms + 1 function**, because **one of its 5 missed lines is dead code**: `get formControlNames(): string[]`. A repo-wide grep returns exactly one hit — its own declaration — with no template and no TypeScript reference. It is left uncovered deliberately rather than cemented; deleting the getter belongs in a separate production PR. ### Verification Review raised 14 findings across two lenses; the repair round took the suite to 214 and every accepted finding was proved by running the reviewer's proposed mutation first, then re-running after the fix to confirm it dies on the named test. Neither file is an instance of apache#7458 — no `TestBed.overrideComponent` in either spec, which the non-zero starting percentages already implied. One earlier misdiagnosis was deliberately **not** re-reported: `dataset-detail.component.html:593`'s `[disabled]` binding does work. `NgModel` routes it through `control.disable()`, deferred to a microtask, so the DOM lags one turn behind `detectChanges()` — asserting immediately reads a stale value and looks like an inert binding. ### Any related issues, documentation, discussions? Closes apache#7832 ### How was this PR tested? ``` npx ng test --watch=false --include="**/dataset-detail.component.spec.ts" --include="**/user-dataset-version-creator.component.spec.ts" ``` ``` Test Files 2 passed (2) Tests 214 passed (214) ``` `yarn format:ci` exits 0; no `junit.xml` left behind. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
dataset-detail.component.htmlwas at 92.0% of lines, 72.9% of branches and 42.9% of functions behind a 129-test spec. This is not an instance of #7458 — the spec uses noTestBed.overrideComponent, so no attribution is lost. The gaps were real: handlers on child outputs, controls inside CDK overlays, the version-creator block, and the false legs of the header and settings ternaries.Tests 129 -> 161, all 32 new ones in one appended
describewith its ownTestBed, no override, real children and real overlays. No existing test or stub is touched.Verification — and a correction
The first pass reported 25 mutations, all killed, zero survivors. That did not hold. Four reviewers were asked to refute the suite; between them they predicted 21 distinct surviving mutations, and every one of the 21 did survive the 154-test suite. 23 of the 24 findings are now fixed, and each repaired kill was re-proved with only the new block selected (
--filter "DatasetDetailComponent rendered template", 129 pre-existing tests skipped), so no new test leans on a neighbour.Two failure modes are worth recording, because neither is visible in a coverage report:
Branches counted as covered and still unpinned. The upload row's tooltip ternary read 2/2 covered, yet swapping its two results passed. Both legs rendered somewhere; nothing asserted which. The same shape hid an exchange of the two
nz-switchmodels and an exchange of the view/like counters.Degenerate fixtures. A row with
totalTimeandestimatedTimeRemainingbothundefinedrenders["1s", "1s left"], becauseformatTimemapsundefined,0and anyn <= 0to"1s"— so swapping elapsed and remaining, a real user-visible bug, was undetectable.formatSpeed(1024)andformatSpeed(40)likewise both render"0.0 MB/s". Those tests now use distinguishable values (12s/1m30s left,5.0 MB/s) and keep the degenerate case as a separate, honestly-named floor test.Also fixed:
toContain("2")against a size of2048(passes on the raw number — nowtoBe("2.00 KB")), twoexpect.any(Number)arguments that left chunk-size and concurrency swappable, and anisLoginflag hidden behindexpect.anything().One mutation is deliberately left alive
html:401[(ngModel)]="selectedVersion"->[ngModel]survives, and that is correct rather than a gap: the same element carries(ngModelChange)="onVersionSelected($event)", andonVersionSelectedassignsthis.selectedVersionitself (ts:527). Removing the two-way sugar leaves an observationally identical component. It is an equivalent mutant, settled by running it rather than by reading.A misdiagnosis worth flagging
An earlier pass concluded that
[disabled]="isCreatingVersion"on the version-name input was inert — thatNzInputDirectiveswallowed the binding because[(ngModel)]supplies anNgControl. That was wrong, and the test settled it:NgModelroutesdisabledthroughcontrol.disable(), which it defers to a microtask, so the DOM simply lags one turn behinddetectChanges(). With the microtask hop the field really does lock. Both the flip and outright deletion of that binding now fail.Deliberately not included
html:585'suserHasWriteAccess() &&is redundant — the enclosingnz-collapseathtml:452is already gated onuserDatasetAccessLevel === "WRITE", which is exactly what that method returns. Reported, not tested.The read-only leg of the description editor's
[editable]is unreachable from the template: the Settings tab itself sits behind*ngIf="userHasWriteAccess()", so a reader never gets there.No production file is touched.
Any related issues, documentation, discussions?
Closes #7680
How was this PR tested?
32 new on top of the existing 129. Coverage measured with
--coverageon the same run.yarn format:cipasses.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)