test(frontend): cover three dashboard services#5203
Conversation
Adds HttpClientTestingModule specs for the dashboard service trio that previously had no (or near-empty) coverage: - dataset.service: every public HTTP wrapper, the authenticated / anonymous endpoint splits, the presigned-URL chain on retrieveDatasetVersionSingleFile, and the fileNodes mapping that createDatasetVersion / retrieveDatasetLatestVersion apply. - workflow-version.service: replaces the 2-test stub with full coverage of the readonly-display lifecycle (snapshot, swap, restore), the joint-paper highlight helpers, the forward-diff classification in getWorkflowsDifference / getOperatorsDifference, and the three version-API HTTP endpoints. - search.service: new spec for the authenticated vs public search routing (with the forced includePublic=true on the anonymous path), the dataset hasMismatch filtering inside executeSearch, and the branchy extendSearchResultsWithHubActivityInfo enrich pipeline (Workflow / Project / Dataset routing, activity-list narrowing, size lookup gating on workflow ids). Closes apache#5202. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5203 +/- ##
============================================
+ Coverage 47.15% 47.81% +0.66%
Complexity 2348 2348
============================================
Files 1042 1042
Lines 39989 39989
Branches 4260 4260
============================================
+ Hits 18855 19121 +266
+ Misses 20012 19727 -285
- Partials 1122 1141 +19
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds comprehensive Angular/Vitest unit tests (HttpClientTestingModule-based) for three previously un(der)-tested dashboard services, improving confidence in HTTP routing, query/body construction, and response mapping without changing production behavior.
Changes:
- Expanded
workflow-version.service.spec.tsto cover readonly-display lifecycle, diff/highlight helpers, and version HTTP endpoints. - Added new
search.service.spec.tscovering authenticated vs anonymous routing, dataset mismatch filtering inexecuteSearch, and hub-activity enrichment logic (counts/likes/access/size). - Added new
dataset.service.spec.tscovering all major dataset endpoints, including presigned-URL download chaining and file-node attachment mapping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts | Replaces minimal coverage with detailed tests for workflow version display/diff/highlight behaviors and related HTTP endpoints. |
| frontend/src/app/dashboard/service/user/search.service.spec.ts | New tests validating search endpoint selection, query param behavior, mismatch filtering, and enrichment via HubService/WorkflowPersistService. |
| frontend/src/app/dashboard/service/user/dataset/dataset.service.spec.ts | New tests asserting dataset API endpoint usage, request construction (params/body/headers), and response mapping behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What changes were proposed in this PR?
Adds
HttpClientTestingModule-based specs for three dashboard services that previously had no (or near-empty) tests:dataset.service.ts— pins the URL, HTTP method, body / query string, and response mapping for every public method, including the authenticated / anonymous endpoint splits, the presigned-URL chain onretrieveDatasetVersionSingleFile, and the file-node attaching thatcreateDatasetVersion/retrieveDatasetLatestVersionperform.workflow-version.service.ts— replaces a 2-test stub with coverage of the readonly-display lifecycle (snapshot, swap, restore), joint-paper highlight helpers, the forward-diff classification ingetWorkflowsDifference/getOperatorsDifference, and the three version-API HTTP endpoints.search.service.ts— covers the authenticated vs public search routing (with the forcedincludePublic=trueon the anonymous path), the datasethasMismatchfiltering insideexecuteSearch, and the branchy enrich pipeline inextendSearchResultsWithHubActivityInfo(Workflow / Project / Dataset entity routing, activity-list narrowing, and the workflow-only size-lookup gating).No production code is touched.
Any related issues, documentation, discussions?
Closes #5202.
How was this PR tested?
Added unit tests for the three services listed above.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7