Ma77Ball opened a new issue, #5227:
URL: https://github.com/apache/texera/issues/5227

   ### Task Summary
   
   Create hub-workflow-detail.component.spec.ts for 
frontend/src/app/hub/component/workflow/detail/hub-workflow-detail.component.ts.
   
   Behavior to cover:
   
   - Constructor / wid resolution — when NZ_MODAL_DATA provides { wid }, uses 
that and leaves isHub = false; otherwise reads wid from 
route.snapshot.params.id and sets isHub = true. Sets isActivatedUser true for 
Role.ADMIN or Role.REGULAR. Always calls 
WorkflowActionService.disableWorkflowModification().
   - ngOnInit — early-returns when wid undefined. Otherwise:
     - HubService.getCounts([Workflow], [wid], [Like, Clone]) → assigns 
likeCount, cloneCount (defaulting to 0).
     - HubService.postView(wid, currentUid ?? 0, Workflow) is debounced via 
throttleTime(THROTTLE_TIME_MS) (1000ms) → assigns viewCount.
     - When a currentUser is defined, calls HubService.isLiked([wid], 
[Workflow]) and sets isLiked from result[0].isLiked (false if empty).
   - ngAfterViewInit / loadWorkflowWithId — when isHub calls 
retrievePublicWorkflow, otherwise retrieveWorkflow; on success reloads via 
WorkflowActionService.reloadWorkflow and triggers center event; on error throws.
   - ngOnDestroy (bound to window:beforeunload) — calls 
WorkflowActionService.clearWorkflow.
   - goBack — navigates to DASHBOARD_HUB_WORKFLOW_RESULT; on failure calls 
NotificationService.error("Go back failed. Please try again.").
   - cloneWorkflow — early-returns when wid undefined; otherwise calls 
HubService.cloneWorkflow(wid), navigates to 
${DASHBOARD_USER_WORKSPACE}/${newWid}, and shows "Clone Successful" success 
notification.
   - toggleLike — short-circuits without userId or wid; calls postUnlike when 
already liked, postLike otherwise; on success flips isLiked and refreshes 
likeCount via getCounts.
   - formatCount — returns "1.0k" for 1000, raw string for <1000.
   - changeViewDisplayStyle — toggles displayPreciseViewCount.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to