test(frontend): cover HubWorkflowDetailComponent#5236
Open
Ma77Ball wants to merge 4 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5236 +/- ##
============================================
- Coverage 48.95% 46.06% -2.89%
+ Complexity 2377 2214 -163
============================================
Files 1048 1049 +1
Lines 40270 40655 +385
Branches 4272 4332 +60
============================================
- Hits 19714 18729 -985
- Misses 19402 20789 +1387
+ Partials 1154 1137 -17
*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:
|
Contributor
Author
|
/request-review @aglinxinyuan |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds focused frontend unit coverage for HubWorkflowDetailComponent, addressing the Hub workflow detail coverage gap described in #5227.
Changes:
- Adds a new Vitest spec for constructor state, lifecycle behavior, workflow loading, navigation, cloning, likes, and formatting helpers.
- Uses standalone child-component stubs with
overrideComponentremove/add so the real parent template still renders under jsdom.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+116
to
+117
| provide: ActivatedRoute, | ||
| useValue: { snapshot: { params: opts.routeId !== undefined ? { id: opts.routeId } : {} } }, |
Comment on lines
+278
to
+285
| build({ modalData: { wid: 5 } }); | ||
| expect(workflowActionServiceMock.reloadWorkflow).not.toHaveBeenCalled(); | ||
| expect(stubGraph.triggerCenterEvent).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("does not reload or trigger center event when retrievePublicWorkflow errors", () => { | ||
| workflowPersistServiceMock.retrievePublicWorkflow.mockReturnValue(throwError(() => new Error("boom"))); | ||
| build({ modalData: undefined, routeId: 9 }); |
Comment on lines
+277
to
+285
| workflowPersistServiceMock.retrieveWorkflow.mockReturnValue(throwError(() => new Error("boom"))); | ||
| build({ modalData: { wid: 5 } }); | ||
| expect(workflowActionServiceMock.reloadWorkflow).not.toHaveBeenCalled(); | ||
| expect(stubGraph.triggerCenterEvent).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("does not reload or trigger center event when retrievePublicWorkflow errors", () => { | ||
| workflowPersistServiceMock.retrievePublicWorkflow.mockReturnValue(throwError(() => new Error("boom"))); | ||
| build({ modalData: undefined, routeId: 9 }); |
aglinxinyuan
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
hub-workflow-detail.component.spec.tscovering constructor wid resolution (NZ_MODAL_DATA vs route), role-basedisActivatedUser, and thedisableWorkflowModificationcall.ngOnInitcount/view/isLiked branches including default-to-0, current-user fallback, and the empty-isLikedresponse case.loadWorkflowWithId(hub vs non-hub fork, success reloads + center event, error path leaves graph untouched),ngOnDestroy → clearWorkflow,goBacksuccess and error,cloneWorkflowearly-return and success,toggleLike(short-circuits, like/unlike, refresh, no-op when service returns false),formatCount, andchangeViewDisplayStyle.overrideComponentremove/add) to swapWorkflowEditorComponent,MiniMapComponent, andMarkdownDescriptionComponentfor selector-equivalent stubs so the real template still renders under jsdom.Any related issues, documentation, or discussions?
Closes: #5227
How was this PR tested?
yarn ng test --watch=false --include=src/app/hub/component/workflow/detail/hub-workflow-detail.component.spec.ts(32 passed).Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7 in compliance with ASF