test(frontend): cover the remaining lines and branches in the coeditor icon, venv page, files uploader and preset wrapper - #7701
Conversation
Extends the specs for CoeditorUserIconComponent, UserVenvComponent, FilesUploaderComponent and PresetWrapperComponent so each file reaches full line and branch coverage. No production code was changed.
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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
*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:
|
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:
CoeditorUserIconComponentlives underworkspace/component/menu/, andPresetWrapperComponentundercommon/formly/.CoeditorUserIconComponent(+5) — the shadowing menu had no test at allbeyond "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 confirmdialog and the delete notification, a record with no
packages, a storedversion that is nullish rather than empty (only nullish reaches
?? ""), and adraft row whose version is null.
FilesUploaderComponent(+5) — the existing suite constructs the componentwith
new, so the template had never rendered (0% on the .html). A second blockmounts it for real and drives the banner
*ngIfthrough all four flagcombinations, its message, its close handler, the drop-zone button and the drop
handler.
PresetWrapperComponent(+6) — a form control holding a value and holdingnull,setupFieldConfig, theapplyPresetStreampredicate with a matching anda non-matching event plus the
basePresetassignment behind it, and thedropdown's own
nzVisibleChangeoutput.Two notes on how the DOM is driven here:
nz-dropdown-menukeeps its content in an ng-template that mounts into a CDKoverlay 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 inthe fixture's DOM so the
*ngFor, the interpolations and the click handlersall 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" testnever awaited the handler's
debounceTime(0), so it passed because thecallback 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-drophands itsopenFileSelectorto the content template byreference, 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 pathswere verified by breaking one assertion per file and confirming all four suites
go red and the run exits non-zero):
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}andpreset-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])