test(frontend): extend UserVenvComponent template coverage - #7334
Conversation
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Extends the UserVenvComponent spec to exercise previously unrendered template branches (list states + nz-modal overlay content) and add a guard-path unit test for saveEnvironment, bringing template/class coverage to 100%.
Changes:
- Adds a
saveEnvironmentguard test to ensure no service calls occur without an active draft. - Introduces a new “template rendering” suite that drives list and modal behavior through DOM interactions.
- Adds CDK overlay flushing helpers to assert modal body/footer content rendered in the overlay.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Automated Reviewer SuggestionsBased on the
|
7d2bc9f to
18fe57c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7334 +/- ##
============================================
+ Coverage 83.36% 83.45% +0.09%
Complexity 4128 4128
============================================
Files 1166 1166
Lines 46428 46428
Branches 5174 5174
============================================
+ Hits 38705 38747 +42
+ Misses 6003 5962 -41
+ Partials 1720 1719 -1
*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?
Extends
user-venv.component.spec.tsto render the template branches the existingclass-focused tests never exercised, taking the template from ~36% to 100%
(
user-venv.component.html102/102). 9 new tests plus one class-guard test:row per environment (with the
(unnamed)fallback); clicking a row opens itsdraft; the delete icon fires
confirmDeletePveand stops row-open propagation.the form, the package header, one row per package, and the footer into the CDK
overlay; the add-package / delete-toggle / Save / Close controls are driven
through the DOM; the
nz-modalcancel (X/mask) output closes the modal.saveEnvironmentno-op-without-draft guard test brings the class to 100% too.Interactions go through the DOM (
By.css+triggerEventHandler/ nativeclick); thenz-modalbody/footer render into the overlay, flushed withApplicationRef.tick(). The backingWorkflowPveServiceis mocked; no layoutassertions. No production code was changed.
Any related issues, documentation, discussions?
Closes #7331.
How was this PR tested?
ng test --watch=false --include src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts— 33 passed, run 3× for determinism (the modal renders into the overlay). Coverage
(
--coverage) confirmsuser-venv.component.htmlat 102/102 and the componentclass at 89/89. The failure path was verified by breaking an assertion (red,
non-zero exit); eslint and prettier are clean.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])