test(frontend): add unit test coverage for DatasetSelectionModalComponent#6529
Conversation
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
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
DatasetSelectionModalComponentVitest spec covering initialization, dataset/version/file selection flows, and confirm behavior. - Stubbed
DatasetServiceandNzModalRefand providedNZ_MODAL_DATAto drive modal behavior in tests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*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?
Adds a Vitest spec for
DatasetSelectionModalComponent(
frontend/src/app/workspace/component/dataset-selection-modal/), whichpreviously had no spec (codecov ~11%).
6 tests, using
TestBed+detectChanges(), withDatasetServiceandNzModalRefstubbed (vi.fn()returningof(...)) andNZ_MODAL_DATAprovided so the modal receives its
{ fileMode, selectedPath }:renders disabled until a path is chosen.
ngOnInitfromdata.selectedPath— in file mode, splits the path intoowner / dataset / version and initializes
selectedDataset,datasetVersions,selectedVersion, andfileTreeaccordingly.onDatasetChange— loads the version list and (in file mode) auto-selectsa version.
onVersionChange— in non-file mode, composesselectedPathas/owner/dataset/versionand loads the file tree.onFileSelected— in file mode, setsselectedPathto the node's full path.onConfirmSelection— closes the modal withselectedPath.DatasetServiceis stubbed inline (no shared stub exists for it). No productioncode 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 wasverified by breaking an assertion to confirm the suite goes red):
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])