mengw15 opened a new pull request, #6525:
URL: https://github.com/apache/texera/pull/6525

   ### What changes were proposed in this PR?
   
   Adds a Vitest spec for `NgbdModalRemoveProjectWorkflowComponent`
   
(`frontend/src/app/dashboard/component/user/user-project/user-project-section/ngbd-modal-remove-project-workflow/`),
   which had no spec (codecov ~5%). Follows `frontend/TESTING.md` (TestBed +
   `detectChanges()`) and mocks `UserProjectService`; the project id is 
injected via
   `NZ_MODAL_DATA`.
   
   13 tests:
   
   - **create / modal data** — renders the template; reads `projectId` from 
`NZ_MODAL_DATA`.
   - **`ngOnInit`** — loads the project's workflows via 
`retrieveWorkflowsOfProject`
     and initializes the checkboxes as unchecked.
   - **`isAllChecked`** — false with no workflows; true only when every box is 
checked.
   - **`changeAll`** — checks all when not all are checked, unchecks all when 
all are,
     and is a safe no-op on an empty list.
   - **`submitForm`** — calls `removeWorkflowFromProject(projectId, wid)` for 
each
     checked workflow (in the high→low index order the splice loop produces) and
     drops the removed entries from the retained `addedWorkflows` cache; does 
nothing
     when nothing is checked; and actually *subscribes* to the removal requests
     (a cold-observable double asserts `forkJoin(...).subscribe()` dispatches 
them).
   - **template wiring** — renders a row per workflow and connects the 
select-all
     checkbox `(change)="changeAll()"` and the Confirm button 
`(click)="submitForm()"`.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6515
   
   ### How was this PR tested?
   
   New Vitest spec, run locally in `frontend/` (all green). Failure paths were
   verified by breaking assertions; the subscription test was additionally 
confirmed
   to fail when `forkJoin(...).subscribe()` is removed from the component, so it
   guards real dispatch rather than just observable construction.
   
   ```
   ng test --watch=false --include 
src/app/dashboard/component/user/user-project/user-project-section/ngbd-modal-remove-project-workflow/ngbd-modal-remove-project-workflow.component.spec.ts
   # Test Files 1 passed (1) / Tests 13 passed (13)
   eslint <spec>      # clean
   prettier --check   # clean
   ```
   
   `UserProjectService` is mocked, so the spec makes no network calls.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
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