Skip to content

test(frontend): extend UserVenvComponent template coverage - #7334

Open
mengw15 wants to merge 1 commit into
apache:mainfrom
mengw15:chore/7331-user-venv-template-test
Open

test(frontend): extend UserVenvComponent template coverage#7334
mengw15 wants to merge 1 commit into
apache:mainfrom
mengw15:chore/7331-user-venv-template-test

Conversation

@mengw15

@mengw15 mengw15 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends user-venv.component.spec.ts to render the template branches the existing
class-focused tests never exercised, taking the template from ~36% to 100%
(user-venv.component.html 102/102). 9 new tests plus one class-guard test:

  • list branches — the empty-state message when there are no environments; a
    row per environment (with the (unnamed) fallback); clicking a row opens its
    draft; the delete icon fires confirmDeletePve and stops row-open propagation.
  • modal — the Create button opens an empty draft; opening the modal renders
    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-modal cancel (X/mask) output closes the modal.
  • a saveEnvironment no-op-without-draft guard test brings the class to 100% too.

Interactions go through the DOM (By.css + triggerEventHandler / native
click); the nz-modal body/footer render into the overlay, flushed with
ApplicationRef.tick(). The backing WorkflowPveService is mocked; no layout
assertions. 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) confirms user-venv.component.html at 102/102 and the component
class 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])

@mengw15
mengw15 requested a lite review from Copilot August 5, 2026 11:12
@mengw15 mengw15 self-assigned this Aug 5, 2026

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

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 saveEnvironment guard 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.

Comment thread frontend/src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts Outdated
Comment thread frontend/src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts Outdated
Comment thread frontend/src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts Outdated
Comment thread frontend/src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts Outdated
Comment thread frontend/src/app/dashboard/component/user/user-venv/user-venv.component.spec.ts Outdated
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

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: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@mengw15
mengw15 force-pushed the chore/7331-user-venv-template-test branch from 7d2bc9f to 18fe57c Compare August 5, 2026 11:50
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.45%. Comparing base (0f2cd49) to head (18fe57c).

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     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 0f2cd49
agent-service 83.65% <ø> (ø) Carriedforward from 0f2cd49
amber 80.65% <ø> (ø) Carriedforward from 0f2cd49
computing-unit-managing-service 43.60% <ø> (ø) Carriedforward from 0f2cd49
config-service 65.97% <ø> (ø) Carriedforward from 0f2cd49
file-service 69.05% <ø> (ø) Carriedforward from 0f2cd49
frontend 84.23% <ø> (+0.20%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 0f2cd49
pyamber 97.36% <ø> (ø) Carriedforward from 0f2cd49
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 0f2cd49

*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 5, 2026 14:11
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.

extend UserVenvComponent template coverage

3 participants