mengw15 opened a new pull request, #6512:
URL: https://github.com/apache/texera/pull/6512
### What changes were proposed in this PR?
Adds a Vitest spec for `NgbdModalAddProjectWorkflowComponent`
(the "add workflow to project" modal), which previously had no spec (codecov
~7%).
4 tests, using `TestBed` + `detectChanges()`, with `UserProjectService` and
`WorkflowPersistService` stubbed (`vi.fn()` returning `of(...)`) and
`NZ_MODAL_DATA` provided so the modal receives its `projectId`:
- **create + render** — the component builds, `retrieveWorkflowsOfProject` /
`retrieveWorkflowsBySessionUser` are called, `unaddedWorkflows` is
populated,
and the template renders one table row per unadded workflow.
- **`isAllChecked()`** — true only when `checkedWorkflows` is non-empty and
every
entry is checked (covers the all/partial/empty cases).
- **`changeAll()`** — checks all when some are unchecked, clears all when
every
one is checked.
- **`submitForm()`** — calls `addWorkflowToProject(projectId, wid)` for each
checked workflow only (skips unchecked) and pushes it to the
`addedWorkflows`
cache.
The service stubs are inline because the existing `StubUserProjectService` /
`StubWorkflowPersistService` leave the methods this component uses
unimplemented.
No production code was changed.
### Any related issues, documentation, discussions?
Closes #6507
### How was this PR tested?
New unit tests, run locally in `frontend/` (all green; the failure path was
verified by breaking an assertion to confirm the suite goes red):
```
ng test --watch=false --include
src/app/dashboard/component/user/user-project/user-project-section/ngbd-modal-add-project-workflow/ngbd-modal-add-project-workflow.component.spec.ts
# Tests 4 passed (4)
eslint <spec> # clean
prettier --check # clean
```
### 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]