test(frontend): extend WorkflowCompilingService, ListItemComponent, and DownloadService coverage#6557
Conversation
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
This PR extends frontend unit test coverage (Vitest) for three existing units—WorkflowCompilingService, ListItemComponent, and DownloadService—to cover previously untested public methods/handlers, without changing production code.
Changes:
- Added tests for
WorkflowCompilingServicepublic getters, including compilation-state/error getters and schema lookup helpers. - Added tests for
ListItemComponentinteraction handlers (edit name/description, checkbox toggle, like/unlike, detail modal open). - Added tests for
DownloadServiceexport methods, including request construction/URL branching and DOM-form based local export behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/app/workspace/service/compile-workflow/workflow-compiling.service.spec.ts | Adds unit tests covering WorkflowCompilingService getter logic and compilation-state stream behavior. |
| frontend/src/app/dashboard/component/user/list-item/list-item.component.spec.ts | Adds unit tests for ListItemComponent edit and interaction handlers (modal, like/unlike, checkbox, view count). |
| frontend/src/app/dashboard/service/user/download/download.service.spec.ts | Adds unit tests for dataset/local export behaviors, including HTTP request validation and hidden-form submission flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nd DownloadService coverage
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6557 +/- ##
============================================
+ Coverage 72.54% 72.68% +0.13%
Complexity 3436 3436
============================================
Files 1145 1145
Lines 45129 45129
Branches 4975 4975
============================================
+ Hits 32738 32800 +62
+ Misses 10709 10631 -78
- Partials 1682 1698 +16
*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:
|
efec911 to
0a06bae
Compare
What changes were proposed in this PR?
Extends three existing frontend specs to cover previously untested methods
(all Vitest; no production code changed).
WorkflowCompilingService(+9 tests) —getWorkflowCompilationState,getWorkflowCompilationErrors(empty while succeeded/uninitialized, surfacesoperator errors when failed),
getCompilationStateInfoChangedStream(replaysthe latest state),
getOperatorOutputSchemaMap,getPortInputSchema, andgetOperatorInputAttributeType. The private compilation-state snapshot is setdirectly and the port-lookup delegates are spied so each getter's own logic is
exercised.
ListItemComponent(+8 tests) —onEditName,onEditDescription(opens theedit modal and applies / closes the change; no-op when not editable),
onCheckboxChange,toggleLike(like / unlike success paths + the no-userguard), and
openDetailModal(opens the modal and bumps the view count).NzModalServiceandHubServiceare spied.DownloadService(+3 tests) —exportWorkflowResultToDataset(POST body /headers, plus the kubernetes
?cuid=URL branch, viaHttpTestingController)and
exportWorkflowResultToLocal(builds and submits the hidden form carryingthe request + token, then cleans up). The download form's
submitand thecleanup
setTimeoutare stubbed so no real navigation or leaked timer occurs.Any related issues, documentation, discussions?
Closes #6552
How was this PR tested?
Extended unit tests, run locally in
frontend/(all green; each spec's failurepath was verified by breaking a new assertion to confirm it goes red):
All collaborators are stubbed, so the suite makes no network calls, opens no
real modal, and triggers no real download (see
frontend/TESTING.md).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])