Skip to content

test(frontend): add unit test coverage for DatasetSelectionModalComponent#6529

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6516-dataset-selection-modal-test
Jul 19, 2026
Merged

test(frontend): add unit test coverage for DatasetSelectionModalComponent#6529
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6516-dataset-selection-modal-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Adds a Vitest spec for DatasetSelectionModalComponent
(frontend/src/app/workspace/component/dataset-selection-modal/), which
previously had no spec (codecov ~11%).

6 tests, using TestBed + detectChanges(), with DatasetService and
NzModalRef stubbed (vi.fn() returning of(...)) and NZ_MODAL_DATA
provided so the modal receives its { fileMode, selectedPath }:

  • create + render — loads accessible datasets on init; the confirm button
    renders disabled until a path is chosen.
  • ngOnInit from data.selectedPath — in file mode, splits the path into
    owner / dataset / version and initializes selectedDataset, datasetVersions,
    selectedVersion, and fileTree accordingly.
  • onDatasetChange — loads the version list and (in file mode) auto-selects
    a version.
  • onVersionChange — in non-file mode, composes selectedPath as
    /owner/dataset/version and loads the file tree.
  • onFileSelected — in file mode, sets selectedPath to the node's full path.
  • onConfirmSelection — closes the modal with selectedPath.

DatasetService is stubbed inline (no shared stub exists for it). No production
code was changed.

Any related issues, documentation, discussions?

Closes #6516

How was this PR tested?

New unit tests, run locally in frontend/ (all green; the failure path was
verified by breaking an assertion to confirm the suite goes red):

ng test --watch=false --include src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
# Tests  6 passed (6)
eslint <spec>       # clean
prettier --check    # clean

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

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

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 18, 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:

  • No candidates found from git blame history.

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

Adds Vitest unit test coverage for DatasetSelectionModalComponent (Angular standalone component under frontend/src/app/workspace/component/dataset-selection-modal/) by introducing a new spec file; no production/frontend runtime code is modified.

Changes:

  • Added a new DatasetSelectionModalComponent Vitest spec covering initialization, dataset/version/file selection flows, and confirm behavior.
  • Stubbed DatasetService and NzModalRef and provided NZ_MODAL_DATA to drive modal behavior in tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.99%. Comparing base (39db110) to head (5839ad2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6529      +/-   ##
============================================
+ Coverage     70.57%   70.99%   +0.41%     
  Complexity     3425     3425              
============================================
  Files          1146     1146              
  Lines         45062    45078      +16     
  Branches       4960     4972      +12     
============================================
+ Hits          31802    32001     +199     
+ Misses        11613    11424     -189     
- Partials       1647     1653       +6     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 39db110
agent-service 76.76% <ø> (ø) Carriedforward from 39db110
amber 66.72% <ø> (ø) Carriedforward from 39db110
computing-unit-managing-service 17.72% <ø> (ø) Carriedforward from 39db110
config-service 52.30% <ø> (ø) Carriedforward from 39db110
file-service 66.80% <ø> (ø) Carriedforward from 39db110
frontend 70.34% <ø> (+0.97%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 39db110
pyamber 91.74% <ø> (ø) Carriedforward from 39db110
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 39db110

*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 July 18, 2026 23:43

@aglinxinyuan aglinxinyuan 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.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 19, 2026
Merged via the queue into apache:main with commit c453eb0 Jul 19, 2026
23 checks passed
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.

add unit test coverage for DatasetSelectionModalComponent

4 participants