mengw15 opened a new pull request, #6392:
URL: https://github.com/apache/texera/pull/6392
### What changes were proposed in this PR?
Adds a Vitest spec for `UserProjectService`
(`frontend/src/app/dashboard/service/user/project/user-project.service.ts`),
which previously had no dedicated spec (codecov ~33%). The service is an
`HttpClient` wrapper for the project dashboard, plus two static color
helpers.
19 tests, using `HttpClientTestingModule` + `HttpTestingController` (no
backend):
- **HTTP methods (14)** — each asserts request method / URL (built from the
service's exported URL constants) / body, and the emitted response:
`getProjectList`, `retrieveWorkflowsOfProject`, `retrieveFilesOfProject`,
`retrieveProject`, `createProject`, `updateProjectName`,
`updateProjectDescription` (raw-string body), `deleteProject`,
`addWorkflowToProject`, `removeWorkflowFromProject`, `addFileToProject`,
`updateProjectColor`, `deleteProjectColor`, `removeFileFromProject`.
- **Cached file list (3)** — `getProjectFiles` starts empty;
`refreshFilesOfProject` fetches and caches; `deleteDashboardUserFileEntry`
deletes then refreshes the cache (two-request flow).
- **Static helpers (2)** — `isInvalidColorFormat` and `isLightColor` across
null / wrong-length / non-hex / 3- and 6-digit / white / black inputs.
`NotificationService` (unused by this service, but a constructor dependency
that pulls in ng-zorro) is stubbed so `TestBed` stays hermetic. No production
code was changed.
### Any related issues, documentation, discussions?
Closes #6388
### How was this PR tested?
New unit tests, run locally in `frontend/` (all green; the failure path was
verified by breaking a URL assertion to confirm the suite goes red):
```
ng test --watch=false --include
src/app/dashboard/service/user/project/user-project.service.spec.ts
# Tests 19 passed (19)
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]