Skip to content

test(frontend): cover the remaining lines and branches in the coeditor icon, venv page, files uploader and preset wrapper - #7701

Merged
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7700-four-frontend-files
Aug 17, 2026
Merged

test(frontend): cover the remaining lines and branches in the coeditor icon, venv page, files uploader and preset wrapper#7701
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7700-four-frontend-files

Conversation

@mengw15

@mengw15 mengw15 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Covers the remaining lines and untaken branches in the four files. All four now
report full line and branch coverage. No production code was changed.

Two of the paths in the issue have moved: CoeditorUserIconComponent lives under
workspace/component/menu/, and PresetWrapperComponent under
common/formly/.

CoeditorUserIconComponent (+5) — the shadowing menu had no test at all
beyond "should create". Both arms of the compound guard now render: shadowing
off, shadowing on for another co-editor (the second half flipped on its own),
and shadowing on for this one. Each variant is then clicked, asserting the
presence service receives shadowCoeditor / stopShadowing.

UserVenvComponent (+5) — the "(unnamed)" fallback on both the confirm
dialog and the delete notification, a record with no packages, a stored
version that is nullish rather than empty (only nullish reaches ?? ""), and a
draft row whose version is null.

FilesUploaderComponent (+5) — the existing suite constructs the component
with new, so the template had never rendered (0% on the .html). A second block
mounts it for real and drives the banner *ngIf through all four flag
combinations, its message, its close handler, the drop-zone button and the drop
handler.

PresetWrapperComponent (+6) — a form control holding a value and holding
null, setupFieldConfig, the applyPresetStream predicate with a matching and
a non-matching event plus the basePreset assignment behind it, and the
dropdown's own nzVisibleChange output.

Two notes on how the DOM is driven here:

  • nz-dropdown-menu keeps its content in an ng-template that mounts into a CDK
    overlay only when the dropdown opens, which jsdom does not drive. Rather than
    assert on the bound data, the tests instantiate that template directly
    (viewContainerRef.createEmbeddedView(templateRef)), which puts the rows in
    the fixture's DOM so the *ngFor, the interpolations and the click handlers
    all really run. This replaces the data-only assertions the preset spec had for
    the same reason.
  • PresetWrapperComponent's "does not refresh while the dropdown is closed" test
    never awaited the handler's debounceTime(0), so it passed because the
    callback had not run yet rather than because the menu was closed — it could not
    fail. It now awaits the tick and also asserts the search term is still tracked.

ngx-file-drop hands its openFileSelector to the content template by
reference, so a spy installed after render is not seen; that test asserts the
effect (the hidden file input is clicked) instead.

Any related issues, documentation, discussions?

Closes #7700

How was this PR tested?

Extended unit tests, run locally in frontend/ (all green; the failure paths
were verified by breaking one assertion per file and confirming all four suites
go red and the run exits non-zero):

ng test --watch=false --include <the four specs>
# Test Files 4 passed (4) | Tests 111 passed (111)
prettier --write <specs>   # clean
eslint  <specs>            # clean

The coverage report was re-run over the four specs to confirm the gaps cleared —
coeditor-user-icon.component.{ts,html}, user-venv.component.ts,
files-uploader.component.{ts,html} and preset-wrapper.component.{ts,html}
each report no unhit line and no partial branch.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Extends the specs for CoeditorUserIconComponent, UserVenvComponent,
FilesUploaderComponent and PresetWrapperComponent so each file reaches full
line and branch coverage. No production code was changed.
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @gupta-sahil01, @Yicong-Huang
    You can notify them by mentioning @gupta-sahil01, @Yicong-Huang in a comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends frontend unit tests to achieve full line and branch coverage for four components without production-code changes.

Changes:

  • Covers remaining conditional and nullish-value branches.
  • Adds rendered-template interaction tests for dropdowns, alerts, file selection, and preset actions.
  • Corrects an asynchronous preset test to await its debounced handler.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
coeditor-user-icon.component.spec.ts Tests shadowing menu states and actions.
user-venv.component.spec.ts Tests missing packages, null versions, and unnamed environments.
files-uploader.component.spec.ts Tests rendered banner and file-drop controls.
preset-wrapper.component.spec.ts Tests initialization, streams, configuration, and dropdown interactions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.93%. Comparing base (363537e) to head (b4040e9).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7701      +/-   ##
============================================
+ Coverage     90.87%   90.93%   +0.05%     
  Complexity     4450     4450              
============================================
  Files          1175     1175              
  Lines         47140    47140              
  Branches       5284     5284              
============================================
+ Hits          42839    42866      +27     
+ Misses         2598     2582      -16     
+ Partials       1703     1692      -11     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 363537e
agent-service 98.62% <ø> (ø) Carriedforward from 363537e
amber 87.37% <ø> (ø) Carriedforward from 363537e
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 363537e
config-service 86.73% <ø> (ø) Carriedforward from 363537e
file-service 68.90% <ø> (ø) Carriedforward from 363537e
frontend 92.44% <ø> (+0.13%) ⬆️
notebook-migration-service 83.74% <ø> (ø) Carriedforward from 363537e
pyamber 97.57% <ø> (ø) Carriedforward from 363537e
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 363537e

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15
mengw15 requested a review from aglinxinyuan August 16, 2026 10:06
@mengw15
mengw15 added this pull request to the merge queue Aug 17, 2026
Merged via the queue into apache:main with commit 9d58135 Aug 17, 2026
36 of 38 checks passed
@mengw15
mengw15 deleted the chore/7700-four-frontend-files branch August 17, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cover the remaining branches in CoeditorUserIcon, UserVenv, FilesUploader, and PresetWrapper

4 participants